Discussions

Expand all | Collapse all

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

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

    Posted 04-17-2017 18:08
    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?


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

    Posted 04-17-2017 18:15
    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


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

    Posted 04-17-2017 18:20
    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


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

    Posted 04-17-2017 18:21
    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())


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

    Posted 04-17-2017 19:55
    You just need to use a "URLEncode()" for the RDR portion.

    URLRoot() & "db/" & Dbid() & "?a=API_EditRecord" &    "&AppToken=buawcnbd5pjszvdimycfs3jdpzd"&
    "&rid="&[Record ID#]&
    "&_fid_107="&URLEncode(User())&
    "&rdr="&
    URLEncode(URLRoot() & "db/" & [_DBID_APPOINTED_LEADS] & "?a=API_GenAddRecordForm&_fid_21=" & URLEncode ([Agency Name])& "&z=" & Rurl())

    That should do it for you.


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

    Posted 04-17-2017 20:08
    Yes! Thank you so much, it worked! 


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

    Posted 04-17-2017 18:25
    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.


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

    Posted 04-17-2017 19:07
    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


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

    Posted 04-17-2017 19:17
    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


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

    Posted 04-17-2017 19:38
    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)


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

    Posted 04-17-2017 19:57
    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!!


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

    Posted 04-17-2017 20:01
    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)


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

    Posted 04-17-2017 20:07
    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


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

    Posted 04-17-2017 20:10
    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();