Forum Discussion

CurtisMiddleton's avatar
CurtisMiddleton
Qrew Trainee
6 years ago

Where to Put Application Token Code in URL Formula

Hi,

I have been scouring trying to resolve this error. Can someone please help take a look and see where I am going wrong with this?
I am receiving this error:
<qdbapi>
<action>API_EditRecord</action>
<errcode>24</errcode>
<errtext>Invalid Application Token</errtext>
<errdetail>An Application Token must be supplied.</errdetail>
</qdbapi>

Here is my code:

var text GoToRecord =

URLRoot() & "db/" & [_DBID_PR_LINES] & "?a=API_GenAddRecordForm&_fid_30=" & URLEncode ([Record ID#])& "&z=" & Rurl() & "&apptoken=[insert token here]";

 

var text COName =

URLRoot() & "db/" & [_DBID_PR_LINES] & "?a=API_EditRecord&rid=" & URLEncode ([Record ID#])& "&z=" & Rurl()

& "&_fid_11=CO#" & [Related Purchase Requisition]

& "&_fid_6=CO#" & [Change Order #] & " " & [Purchase Requisition - PO #] & "&apptoken=[insert token here]";

 

$GoToRecord

& "&rdr=" & URLEncode($COName)

-----------
Thank you,



------------------------------
Curtis Middleton
------------------------------
  • Curtis,

    Here is the cheat sheet for all the ones I build

    // Declare Token
    var text Token ="abcdefghijklmnopqrstuv";

    // Declare URLs

    var text URLGenAdd =
      URLRoot() & "db/" & [_Table] &
      "?a=API_GenAddRecordForm&_fid_8=" & URLEncode ([Record ID#])&
      "&dfid=10" &
      "&z=" & Rurl();

    var text URLAPIEdit =
      URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&apptoken="& $Token & "&rid=" &[Record ID#] & "&_fid_14="&1;

    var text URLAPIAdd =
      URLRoot() & "db/" & [_Table] & "?a=API_AddRecord&AppToken=" &$Token & "&_fid_6=" & URLEncode ([Record ID#]);

    var text URLEdit =

      URLRoot() & "db/" & Dbid() & "?a=er&rid="&URLEncode([Record ID#])&"&dfid=12"& "&z=" & Rurl();

    // Java Execute URL
    "<a href=\"javascript:" & "$.get('" & $URL  & "', function(){" & "location.reload();" & "});" & "void(0);\">"&$IMG&"</a>"


    ------------------------------
    Don Larson
    Paasporter
    Westlake OH
    ------------------------------
    • CurtisMiddleton's avatar
      CurtisMiddleton
      Qrew Trainee
      Don,

      Thank you for your help.
      I appreciate the cheat sheet.

      Regards,

      ------------------------------
      Curtis Middleton
      ------------------------------