Forum Discussion

IvanWeiss's avatar
IvanWeiss
Qrew Captain
5 years ago

Button Not Executing API Code

I have a button performing two functions with a javascript popup.  When I click the button I do see the javascript popup but the API code is not working:

//Create an order
var text URLCreateOrder = URLRoot() & "db/" & [_DBID_SALES_ORDERS] & "?a=API_AddRecord" &
"&apptoken=8nd4ztc8b3ed4us3hn7bgqbxmi" &
"&_fid_10=" & [Subtotal Sell (Less Tax)] &
"&_fid_14=" & &
"&_fid_15=" & [Rebate Carried] &
"&_fid_16=" & [PM Fee Carried] &
"&_fid_20=" & URLEncode("Generating Sales Order") &
"&_fid_26=" & URLEncode("Order auto created with proposal win button.") &
"&_fid_27=" & [Related Opportunity];

//Mark the status as client approved and redirect to the Opportunity so the user can approve it
var text URLEditStatus = URLRoot() & "db/" & Dbid() & "?a=API_EditRecord" &
"&rid=" & [Record ID#] &
"&apptoken=8nd4ztc8b3ed4us3hn7bgqbxmi" &
"&_fid_28=" & URLEncode("Proposal approved.") &
"&_fid_29=" & URLEncode("Client Approved") &
"&_fid_46=" & URLEncode(Today()) &
"&rdr=" & URLEncode(URLRoot() & "db/" & [_DBID_OPPORTUNITIES] & "?a=er&rid=" & [Related Opportunity]);

//Create URL for javascript call
var text URL = $URLCreateOrder & "&rdr=" & URLEncode($URLEditStatus);

//Remind the user to mark the opportunity as approved
"javascript:" &"$.get('" & $URL & "',function(){" &"location.reload(true);" &"});" & "void(0);alert('Please ensure the opportunity value is updated and mark the opportunity as won. An order was automatically created for you but please ensure the Project Coordinator verifies its information. CONGRATULATIONS!');"

------------------------------
Ivan Weiss
------------------------------
  • Ivan

    1. If you comment out the javascript and just run the URL, does it work?
    2. In my experience, having a javascript refresh like you have and URL with redirects (&rdr=".....), does not work.

    Mark

    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------
    • IvanWeiss's avatar
      IvanWeiss
      Qrew Captain
      I have not yet tried out to comment out the javascript, I can do that in a bit.  

      My intent with the javascript is just to get a popup box to show to remind the user of some other things I need them to do.  is there a way to do that that would work in this scenario?

      ------------------------------
      Ivan Weiss
      ------------------------------
      • MarkShnier__You's avatar
        MarkShnier__You
        Icon for Qrew Legend rankQrew Legend
        Sorry I don't know who to reliably do that where there are multiple API calls.

        ------------------------------
        Mark Shnier (YQC)
        Quick Base Solution Provider
        Your Quick Base Coach
        http://QuickBaseCoach.com
        mark.shnier@gmail.com
        ------------------------------