Forum Discussion

JoshuaCase's avatar
JoshuaCase
Qrew Cadet
5 years ago

URL Button to auto-complete form

Is there a way to add a button that will edit a record with "pre-planned" data?  Looking for a quick approval system for an app I created for employee overtime requests.  This button would be only accessible to the app admin(s) and would generally set a Text multi select field to "yes", User List to the approver, and add a brief description of "Approved" to a multi-line text field.  

Any help is appreciated.

------------------------------
Joshua Case
------------------------------

2 Replies

  • Yes. Buttons like this require some understanding of the QuickBase API, and once you have that so many doors will be open to you!

    Also, check out an application in the marketplace called Magic Buttons. It's basically a bunch of sample buttons that you can copy code from to get the framework for what you want to do.  I think all you'll need to do is a few EditRecord calls and you'll be set. Note that in that app, the builder gives examples for both Text and URL versions, but I don't believe the Text versions are supported anymore, so you'll have to use the URL versions. Give that a go and let me know if you're having any difficulty.

    ------------------------------
    Joshua Krohn
    ------------------------------
    • MarkShnier__You's avatar
      MarkShnier__You
      Icon for Qrew Legend rankQrew Legend
      Here is an example below.  In addition to Kirk Trachy's Magic Buttons app, there is also an app I put in the Exchange called URL formulas for Dummies.

      var text URL =
      URLRoot() & "db/" & Dbid () & "?act=API_EditRecord&rid=" & [Record ID#]
      & "apptoken=xxxxxxxxx"
      & "&_fid_12="&URLEncode("Yes") // set fid 12 field to Closed
      & "&_fid_13="&URLEncode(ToText(User)) // set fid 13 field to the text value of the current user
      & "&_fid_14="&URLEncode("Approved") // set fid 14 field to Approved;

      "javascript:" &
      "$.get('" &
      $URL &
      "',function(){" &
      "location.reload(true);" &
      "});"
      & "void(0);"

      Notes:

      You only really ned to do the URLEncode if the values will contain spaces or unusual characters.
      The line in bold may be omitted if you disable the need for Application Tokens.

      What that formula does is to set up a formula variable called URL with what the API needs to do.  Then that javascript stuff runs the formula variable called URL and refreshes the page.

      Notes that if you have errors in the URL, that particular syntax will not reveal the error message.  to debug, you would need to comment out or remove  out that javascript and just run the URL.  Then once its working, put back the syntax above.

      If you run into any problems, post your formula and the error message.

      ------------------------------
      Mark Shnier (YQC)
      Quick Base Solution Provider
      Your Quick Base Coach
      http://QuickBaseCoach.com
      markshnier2@gmail.com
      ------------------------------