The code is this:
Button Code:
"javascript:" &
"var QBU_rid = '" & [Record ID#] & "';" &
"$.getScript(gReqAppDBID + '?a=dbpage&pagename=myscript.js');" &
"void(0);"
Javascript Page Code:
var apptoken = "your application token here";
$.ajaxSetup({data: {apptoken: apptoken}});
var reason = prompt("Enter your reason For Declining This Request: ", "");
var promise = $.get(gReqDBID,{
act: "API_EditRecord",
rid: QBU_rid,
_fid_6: reason
});
$.when(promise).then(function(){
document.location.href = gReqDBID + "?a=dr&rid=" + QBU_rid;
});
// This example code was originally created by Dan Diebolt. His contact information is 734-985-0721 and email address is dandiebolt@yahoo.com //
The code works as intended, of course, but I would like to adapt it by making the field ID number (6, in the above code) a variable instead. If I could do that, I could re-use the javascript page in multiple places. As is, I'd need a new page every time I want to use the code, just to change the field id.Ideally, I'd like to pass the fid number from the formula-url button the user will click.
Thank you for the help!
------------------------------
Graham Haskin
------------------------------