Forum Discussion

JordanLitwin's avatar
JordanLitwin
Qrew Member
10 months ago

Edit Record API Button

I'm trying to create a button that uses the API_EditRecord that will check a box in that record. I've been using the example URL in the Quickbase help section but I'm not sure on a few points. For reference here is the structure that I have so far:

URLRoot() & "db/[DBID]?a=API_EditRecord&rid=" & [Record ID#] & "&_fid_1=true&update_id=[UPDATEID]&usertoken=[USERTOKEN]&apptoken=[APPTOKEN]"

  • What do I put in for the correct update_id?
  • By saying fid_1=true is that going to set the checkbox field to checked?
  • Is putting in the field [Record ID#] going to work for specifying the record when the button is pushed?

Thanks, 



------------------------------
Jordan Litwin
------------------------------
  • Hi Jordan,

    The methods we use to make formula URL buttons are not well documented except through the Community Forum Discussions, so you have come to the right place.

    Here is how I would do it.  Note that when you do a API call, if you do not redirect  the user back to a record or a report or some other page in QB, then it will blurt out an XML success (or failure) message on the screen, which is most unfriendly to the user and leaves them no where useful.  So you need at least 2 steps in these buttons, one to do the API and then one to redirect the user.

     You can sting a series of these together if you need to and generically nest them like this.

    $URLONE 
    & "&rdr=" & URLEncode($URLTWO)
    & URLEncode("&rdr=" & URLEncode($URLTHREE))
    & URLEncode(URLEncode("&rdr=" & URLEncode($URLFOUR)))
    & URLEncode(URLEncode(URLEncode("&rdr=" & URLEncode($URLFIVE))))
    & URLEncode(URLEncode(URLEncode(URLEncode("&rdr=" & URLEncode($URLSIX)))))
    & URLEncode(URLEncode(URLEncode(URLEncode(URLEncode("&rdr=" & URLEncode($URLSEVEN))))))

     

    So in  your case you need to steps so you just slice off as much of the salami as you need.

    Lastly , there is special syntax to refresh the page you are on, as that is a typical place to want to land the user after the button's API is run.  You can have alternate syntax to redispay the record you are in, but the page refresh can be very useful when the button is in a child record and you are in the parent, for example, One Project has Many Tasks and you have an embedded child table where you want a button to mark the task completed and the refresh the parent Project page.

    So to translate all the above to your use case.

    var text Approve = URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&rid=" & [Record ID#]
    & "&_fid_99=1"; // change the 99 to the field ID# of the checkbox field 

    var text RefreshPage =  URLRoot() & "db/" & Dbid() & "?a=doredirect&z=" & Rurl();

     
    $Approve
    & "&rdr=" & URLEncode($RefreshPage)



    ------------------------------
    Mark Shnier (Your Quickbase Coach)
    mark.shnier@gmail.com
    ------------------------------

    • JordanLitwin's avatar
      JordanLitwin
      Qrew Member

      Brilliant, thank you so much Mark! Your help is always greatly appreciated.



      ------------------------------
      Jordan Litwin
      ------------------------------