Skip to main content
Question

Button Not Executing API Code

  • August 12, 2020
  • 0 replies
  • 21 views

Forum|alt.badge.img+11
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
------------------------------

MarkShnierYou
Forum|alt.badge.img+22
  • Quickbase Alumni
  • August 12, 2020
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
------------------------------