Forum Discussion

JeremyMyer's avatar
JeremyMyer
Qrew Trainee
5 years ago

javascript to use return value from javascript

I'm struggling trying to find how to call a javascript function inside a button to get the current url, then use this current url in my API_EditRecord button...I fell I'm super close, just not invoking the script properly...any help would be great!!

//----------------------------------JS which properly returns the url:-------------------------------------------------------------------
(function(){
var querystring=window.location.href;
alert(querystring);
})();


//-----------------------------------------------------------------------------------------Button code below--------------------------------------------
If([Status]="In Inventory/Idle",


var text javavariable =
"javascript:" &
"$.get(function(){" &
"window.location.href;" &
"})();"
;

var text URL =

URLRoot() & "db/" & Dbid() & "?a=API_EditRecord" &
"&rid=" & [Record ID#] &
"&apptoken=3zjjxcfi6gmacdiekickzax92" &
"&_fid_14=In Use" & //Set Status to Being used. This will fire automation to create an Event.
 "&_fid_20=javavariable" & //Get the variable from Java 

"&rdr=" &
URLEncode(URLRoot() & "db/" & Dbid() &
"?a=dr&rid=" & [Record ID#])

;
"javascript:" &
"$.get('" &
$URL &
"',function(){" &
"location.reload(true);" &
"});"
& "void(0);"

, "")

------------------------------
Jeremy Myer
------------------------------
No RepliesBe the first to reply