Forum Discussion

JeremyMyer's avatar
JeremyMyer
Qrew Trainee
3 years ago

Utilize API_Add Record Response values

Does anyone know how to get the API Response information to be able to utilize it in a redirect?  I have a button where I 'replace' a part, I want to show the new part after the API_Add Record call.  I can't seem to find it anywhere.   If I omit the &rdr line I end up on the API response, which clearly shows the new rid.  Button code below


Any thoughts would be great!  Thanks in advance.

var text url =
URLRoot() & "db/" & [_DBID_TEST_PARTS] & "?a=API_AddRecord" &"&apptoken="&[app token]
& "&_fid_73=" & URLEncode([Related SPARK Test Item])
& "&_fid_75=" & [Header - Label Header (ref)]
& "&_fid_80=" & [Related SPARK]
& "&_fid_205=" & [Fit Condition]
& "&_fid_135=" & [Additional Info]
& "&_fid_223=" & [Record ID#]
& "&_fid_125=true"
& "&_fid_72=" & $uselabel
& "&_fid_123=" & ([Replacement Counter] + 1)
& "&_fid_127=" & [Full Label]
& "&rdr="&URLEncode(URLRoot() & "db/" &Dbid() & "?a=dr&rid=" & URLEncode([Record ID#]));  //I want to utilize the newly created rid here.

If([Hide Replace Button]=true,"",
"<a class='Vibrant Success' href='" & $url & "'>Replace this part</a>")

------------------------------
Jeremy Myer
------------------------------

4 Replies

  • When the button is clicked, everything after var text url = is sent to the Quickbase server.
    To do what you are trying to do would require a Code page with javaScript that would run in the browser and handle the response.

    1. change button to call code page
    2. use https://resources.quickbase.com/db/bq8kmgrcq/72b77352-3b9d-495e-932f-1cd9f1b15fa3 to write the code page.

    I am working on something like this now. If I can figure out a simple proof of concept, I'll put up a post.

    ------------------------------
    Jim Harrison
    transparency = knowledge + understanding : The Scrum Dudes
    ------------------------------
    • MarkShnier__You's avatar
      MarkShnier__You
      Icon for Qrew Legend rankQrew Legend
      This syntax works to use the RID of the newly created record.  See if you can adapt it to your needs. 

      var text RID = "%%rid%%";

      var text AddShipment = URLRoot() & "db/" & Dbid() & "?a=nwr";
      var text EditShipment = URLRoot() & "db/" & Dbid() & "?a=er&rid=" ;

      var text URL = 
      $AddShipment 
      & "&rdr=" & URLEncode($EditShipment) & $RID;


      "<a class='SaveBeforeNavigating' data-replaceRid=true style=\"text-decoration:none; background: #4b7097; border-radius: 5px; color: #ffffff; display: inline-block; padding: 0px 0px 0px 0px; width:100px; text-align: center; text-shadow: none; border: 2px solid #030404; font-size: 12px \"href='"
      & $URL
      & "'>Save and Display in Edit Mode</a>"

      NOTE:  The %%RID%% does not seem to like being URLEncoded.

      The user would need to push this button (Rich Text formula field type) to save the record, not the regular save button.

      If you can lanch off a buton that suffixed the URL with

      &ivf=1,

      that would suppress the native save buttons forcing the user to use this special button.

      ------------------------------
      Mark Shnier (YQC)
      mark.shnier@gmail.com
      ------------------------------