Forum Discussion

Jan-WillemSpeck's avatar
Jan-WillemSpeck
Qrew Assistant Captain
3 years ago

API_CopyMasterDetail - how to return to parent record? - API_CopyMasterDetail 0 No error 16 9

Hi,
I have a Parent table PROjects and a child table ACTivities
Parent record #13 exists of certain selection of ACTivities and acts as a template record when new PROjects are created. (eventually more templates will follow based on project type)​
After creating a new parent PROject the intention is to copy the relevant ACTivities from the template via a button pressed by the user when applicable.

Using a formula URL field my current code looks like:
URLRoot() &"db/" & [_DBID_PROjects]& "?a=API_CopyMasterDetail&destrid="&[Record ID#]&"&sourcerid=13"
This works: The ACTivities are added to the new created project PROject.

But how to return to the parent PROject?
after checking several posts on the form I tried to achieve this by adding
& "&z=" & Rurl()

But i keep landing on a page with URL:
https://*******.quickbase.com/db/*********?a=API_CopyMasterDetail&destrid=16&sourcerid=13&z=cup
with the following text  API_CopyMasterDetail 0 No error 16 9 on screen
pressing the browser 'back' button brings me to the parent record with the correct added child records.



PS
1) App tokens have been disabled, this is all happening inside QuickBase
2) I left the ticket parameter empty as following other forum posts there is no reason to worry about tickets when you are already logged into QuickBase.





------------------------------
Jan-Willem Speckmann
------------------------------

5 Replies

  • In general, the generic syntax to string multiple URLs together upon a button click is 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)))))

    In your case we want to do two steps.

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

    So we define the formula variables.



    var text COPY = URLRoot() &"db/" & [_DBID_PROjects]& "?a=API_CopyMasterDetail&destrid="&[Record ID#]&"&sourcerid=13";

    var text Display = URLRoot() & "db/" & dbid() & "?a=dr&rid=" & [Record ID#];

    $COPY
    & URLEncode($Display)

    ~~~~~~~~~~~~~~~~~~
    I like to use formula variables in my formula for readability and ease of debugging
    https://help.quickbase.com/user-assistance/formula_variables.html




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