IvanWeiss
5 years agoQrew Captain
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
------------------------------
//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
------------------------------