Forum Discussion
QuickBaseCoachD
6 years agoQrew Captain
?a=API_GenAddRecordForm" will pop up an Add Record form for a human user to complete and manually save. That could only be used as the very last step in an API Button.
?a=API_AddRecord" will create a record.
You want to use the latter API
?a=API_AddRecord" will create a record.
You want to use the latter API
- IvanWeiss6 years agoQrew CaptainI actually do have that, I changed it to gen addrecordform in an attempt to troubleshoot to see if it ever showed the form. It does not show the form and it does not add the record
- QuickBaseCoachD6 years agoQrew CaptainI'm confused now. Can you post the code that is not working?
- IvanWeiss6 years agoQrew CaptainIt is that same code, I just fixed that one line you mentioned. But it is not running that add API
//Button Functionality:
//1. Change the stage of the opportunity to won
//2. Set the Date Won to Today
//3. Check to see if opportunity is of type design.
// If true, assign a task to Lisa to create the sales order.
//4. Redirect back to the same form to display the record with updates.
//*******************************************************************************************************************
//Step 1 and 2
var text urlOne = URLRoot() & "db/" & Dbid() & "?a=API_EditRecord" &
"&rid=" & [Record ID#] &
"&apptoken=c5gchf9bhwx6umbd2ii5zdqtb5x8" &
"&_fid_9=Won" &
"&_fid_23=" & URLEncode(Today());
//Step 3 - Build urlTwo variable if the type is design. This assigns the sales order creation to lisa as a task.
var text urlTwoIfDesign = URLRoot() & "db/" & [_DBID_TASKS] & "?a=API_AddRecord" &
"&apptoken=c5gchf9bhwx6umbd2ii5zdqtb5x8" &
"&_fid_31=" & URLEncode(ToUser("ljording@elitestudioe.com")) &
"&_fid_36=" &URLEncode("Task created automatically through Opportunity Win Button") &
"&_fid_9=" & URLEncode(ToWeekdayN(Today())) &
"&_fid_12=" & [Record ID#] &
"&_fid_21=" & [Project] &
"&_fid_24=Active" &
"&_fid_38=" & URLEncode(ToText(ToUserList([Project Solutions T1],[Project Solutions T2]))) &
"&_fid_23=Opportunity" &
URLEncode("&_fid_83=Not Applicable") &
"&_fid_6=Create Sales Order - Design Opportunity";
//Step 3 - Build urlTwo variable if the type is build. THE FOLLOWING IS A COPY OF THE ABOVE AS I DID NOT BUILD THE LOGIC OUT YET
var text urlTwoIfBuild = URLRoot() & "db/" & [_DBID_TASKS] & "?a=API_AddRecord" &
"&apptoken=c5gchf9bhwx6umbd2ii5zdqtb5x8" &
"&_fid_31=" & URLEncode(ToUser("ljording@elitestudioe.com")) &
"&_fid_36=" &URLEncode("Task created automatically through Opportunity Win Button") &
"&_fid_9=" & URLEncode(ToWeekdayN(Today())) &
"&_fid_12=" & [Record ID#] &
"&_fid_21=" & [Project] &
"&_fid_24=Active" &
"&_fid_38=" & URLEncode(ToText(ToUserList([Project Solutions T1],[Project Solutions T2]))) &
"&_fid_23=Opportunity" &
URLEncode("&_fid_83=Not Applicable") &
"&_fid_6=Create Sales Order - Design Opportunity";
//Step 4
var text redirect = URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#];
//URL Execution
Case(true,
[Opportunity Type] = "Design", $urlOne & URLEncode($urlTwoIfDesign) & "&rdr=" & URLEncode($redirect),
[Opportunity Type] = "Build", $urlOne & URLEncode($urlTwoIfBuild) & "&rdr=" & URLEncode($redirect)
) - Laura_Thacker6 years agoQrew CommanderYou may need to double-encode the redirect.URLEncode(URLEncode($redirect))
- IvanWeiss6 years agoQrew CaptainIts not the redirect that is not running. It is not adding a task per this section: Would the redirect have anything to do with that?
//Step 3 - Build urlTwo variable if the type is design. This assigns the sales order creation to lisa as a task.
var text urlTwoIfDesign = URLRoot() & "db/" & [_DBID_TASKS] & "?a=API_AddRecord" &
"&apptoken=c5gchf9bhwx6umbd2ii5zdqtb5x8" &
"&_fid_31=" & URLEncode(ToUser("ljording@elitestudioe.com")) &
"&_fid_36=" &URLEncode("Task created automatically through Opportunity Win Button") &
"&_fid_9=" & URLEncode(ToWeekdayN(Today())) &
"&_fid_12=" & [Record ID#] &
"&_fid_21=" & [Project] &
"&_fid_24=Active" &
"&_fid_38=" & URLEncode(ToText(ToUserList([Project Solutions T1],[Project Solutions T2]))) &
"&_fid_23=Opportunity" &
URLEncode("&_fid_83=Not Applicable") &
"&_fid_6=Create Sales Order - Design Opportunity"; - QuickBaseCoachD6 years agoQrew CaptainRight, the generic form to nest URls in a button is this
$URLONE
& "&rdr=" & URLEncode($URLTWO)
& URLEncode("&rdr=" & URLEncode($URLTHREE))
& URLEncode(URLEncode("&rdr=" & URLEncode($URLFOUR)))
Slice off as much of the salami as you need.
Mark - IvanWeiss6 years agoQrew CaptainI realized it based on the above post. I was missing the rdr for the second and third variable. I was just joining with & and that was the issue.