Skip to main content
Question

Can I string an API call to set a field to current user AND then gen add form in a different table?

  • April 17, 2017
  • 0 replies
  • 134 views

I have a formula URL button linked to a different table. I want to string an API call to this so that before it links you over to the new form, it also changes a field (labeld "Marketing Rep") to the current user. Is this doable? Or would I need two buttons?
This topic has been closed for replies.

  • Registered
  • April 17, 2017
Are you asking to edit the record you are on first then go to the new form?  Or, When you get to the new form change the Marketing Rep?

Either way, they are both possible.

Just need the field ID of the "Marketing Rep" and use the formula "User()" as the value to be written.

If you post your formula, and the field ID, I can help with the syntax

  • Author
  • Registered
  • April 17, 2017
The first bit, yea! I need it to edit the record I am on first, then go to the new form on a new table. 

Here is what I have so far, 



URLRoot() & "db/" & Dbid() & "?a=API_EditRecord" &    "&AppToken=" &
    "&rid=buawcnbd5pjszvdimycfs3jdpzd" & 
    "&rid=" & [Record ID#] &
    "&_fid_107=" & URLEncode(User()) &

"&rdr="&



URLRoot() & "db/" & [_DBID_APPOINTED_LEADS] & "?a=API_GenAddRecordForm&_fid_21=" & URLEncode ([Agency Name])& "&z=" & Rurl())

I am fairly new to QuickBase but I have become knowledgeable enough to be dangerous, but API calls are not my strong suit at all. So this may be a really bad formula

  • Author
  • Registered
  • April 17, 2017
Sorry, bothced it in the copy. 

URLRoot() & "db/" & Dbid() & "?a=API_EditRecord" &    "&AppToken=buawcnbd5pjszvdimycfs3jdpzd" &
    "&rid=" & [Record ID#] &
    "&_fid_107=" & URLEncode(User()) &

"&rdr="&

URLRoot() & "db/" & [_DBID_APPOINTED_LEADS] & "?a=API_GenAddRecordForm&_fid_21=" & URLEncode ([Agency Name])& "&z=" & Rurl())

  • Author
  • Registered
  • April 17, 2017
If it helps, this formula does change the Marketing Rep to the current user, it just doesnt re direct to the Gen Add Form in the other table.

I took this from the Magic Buttons App.
It might give you the right idea.

URLRoot() & "db/" & [_DBID_CLIENT] & "?a=API_EditRecord&apptoken=d9eascudwjxs2sesxkjccwgtq9r&_fid_28=Completed&_fid_153=Completed&_fid_143=100&rid=" & [Record ID#] & "&rdr=" &    URLEncode(URLRoot() & "db/" & [_DBID_PROJECT_SNAPSHOTS] & "?a=API_AddRecord&apptoken=d9eascudwjxs2sesxkjccwgtq9r&_fid_6=" & [Project Name] & "&_fid_7=" & [Status] & "&_fid_8=" & [Priority] & "&_fid_9=" & [Est Start Date] & "&_fid_10=" & [Est End Date] & "&rdr=" &
        URLEncode(URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#]))

// Edit the record and change the status to Completed then redirect to
// Adding a Project Snapshot record to the Project Snapshot table then redirect to
// displaying the original record

  • Author
  • Registered
  • April 17, 2017
I'm a bit too new to QuickBase to really try and modify this formula, but I will give it a try. I can kinda see how it would help.

Thank you

i have put an application in the exchange called URL Formuals for Dummies.  It explains who to string URLs together.

But here is what should work for your example.  I like to use "formula variables" as it makes the formuals much easier to read.

var text URLONE = URLRoot() & "db/" & Dbid() & "?a=API_EditRecord" &    "&AppToken=buawcnbd5pjszvdimycfs3jdpzd" &
    "&rid=" & [Record ID#] &
    "&_fid_107=" & URLEncode(User())

var text URLTWO = URLRoot() & "db/" & [_DBID_APPOINTED_LEADS] & "?a=API_GenAddRecordForm&_fid_21=" & URLEncode ([Agency Name])& "&z=" & Rurl())

$URLONE
& "&rdr=" & URLEncode($URLTWO)

  • Author
  • Registered
  • April 17, 2017
Awesome, I dont really know much about variables, but this is giving me an error saying variable declarations must end in semicolons. I have put a semicolon everywhere I believe a declaration is over, but its giving me the same error, any help?

Thank you so much!!

Right, I'm missing the ending ;

trey this

var text URLONE = URLRoot() & "db/" & Dbid() & "?a=API_EditRecord" &    "&AppToken=buawcnbd5pjszvdimycfs3jdpzd" &
    "&rid=" & [Record ID#] &
    "&_fid_107=" & URLEncode(User());

var text URLTWO = URLRoot() & "db/" & [_DBID_APPOINTED_LEADS] & "?a=API_GenAddRecordForm&_fid_21=" & URLEncode ([Agency Name])& "&z=" & Rurl());

$URLONE
& "&rdr=" & URLEncode($URLTWO)

  • Author
  • Registered
  • April 18, 2017
var text URLONE = URLRoot() & "db/" & Dbid() & "?a=API_EditRecord" &    "&AppToken=buawcnbd5pjszvdimycfs3jdpzd" &
    "&rid=" & [Record ID#] &
    "&_fid_107=" & URLEncode(User());

var text URLTWO = URLRoot() & "db/" & [_DBID_APPOINTED_LEADS] & "?a=API_GenAddRecordForm&_fid_21=" & URLEncode ([Agency Name])& "&z=" & Rurl()  );

$URLONE
& "&rdr=" & URLEncode($URLTWO)

This is the error I keep getting

sorry there is an extra ) at the end of URLTWO


This part should be 


var text URLTWO = URLRoot() & "db/" & [_DBID_APPOINTED_LEADS] & "?a=API_GenAddRecordForm&_fid_21=" & URLEncode ([Agency Name])& "&z=" & Rurl();