Discussions

Expand all | Collapse all

New functionaility %%rid%%

  • 1.  New functionaility %%rid%%

    Posted 14 days ago
    Has anyone used the new feature that allows you to grab the record ID from a custom Rich Text button on an add record form? Ive used it once successfully, and now am completely stuck on why i cant get it to work again.

    In my code below I am trying to pass the new record ID to field 57 in my addcontract variable. (57 is a numeric field). But instead of the new RID it inserts 'id'. I've tried wrapping with URLEncode, no luck. Thoughts?

    var text AddContract = URLRoot() & "db/" & "brgdpr9fn?a=API_GenAddRecordForm"
    & "&_fid_12=" & URLEncode ([Related Vendor])
    & "&_fid_57=" & "%%rid%%";

    var text EditUserFocus =
    URLRoot() & "db/" & "bp8yr9i5s?a=API_EditRecord" &
    "&key=" & UserToEmail(User()) &
    "&apptoken=xxxxxxxxxxxxxxxxxxxxxxxxx" &
    "&_fid_220=" & [Service Order - SO #] &
    "&_fid_224=" & [Related Service Order];

    "<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='"
    & $EditUserFocus
    & "&rdr=" & URLEncode($AddContract)
    & "'>Add Subcontract</a>"

    ------------------------------
    Mike Tamoush
    ------------------------------


  • 2.  RE: New functionaility %%rid%%

    Posted 14 days ago
    Try this:

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

    var text AddContract = URLRoot() & "db/" & "brgdpr9fn?a=API_GenAddRecordForm"
    & "&_fid_12=" & URLEncode ([Related Vendor])
    & "&_fid_57=";

    var text EditUserFocus =
    URLRoot() & "db/" & "bp8yr9i5s?a=API_EditRecord" &
    "&key=" & UserToEmail(User()) &
    "&apptoken=xxxxxxxxxxxxxxxxxxxxxxxxx" &
    "&_fid_220=" & [Service Order - SO #] &
    "&_fid_224=" & [Related Service Order];

    "<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='"
    & $EditUserFocus
    & "&rdr=" & URLEncode($AddContract) & $RID
    & "'>Add Subcontract</a>"

    ------------------------------
    Brad Lemke
    ------------------------------



  • 3.  RE: New functionaility %%rid%%

    Posted 13 days ago
    No luck, now it puts in nothing.

    ------------------------------
    Mike Tamoush
    ------------------------------



  • 4.  RE: New functionaility %%rid%%

    Posted 13 days ago
    To explain what I did: the "%%rid%%" function fails when it is embedded inside a URLEncode(...).  Referencing it outside of the Encode won't break it, and typically makes it work perfectly for me in very similar scenarios (I use it in two places in my app).  It can be finicky and I'm still learning the nuances. 

    Does the URL of the page you're redirected to (the genaddrecordform) have any artifacts or anything that looks off?

    ------------------------------
    Brad Lemke
    ------------------------------



  • 5.  RE: New functionaility %%rid%%

    Posted 13 days ago

    Interesting about it failing inside URLEncode.

    Nothing I can find particularly off. If I save the record, and then use 'Record ID' instead of %%rid%%, it works fine, but thats not really a surprise. 

    What kind of 'artifacts' are you thinking could cause havoc?



    ------------------------------
    Mike Tamoush
    ------------------------------



  • 6.  RE: New functionaility %%rid%%

    Posted 13 days ago
    Oh wait. So I found what I thought was the issue. I had changed to a popup instead of savebefore navigating. I changed that back and now I have my original issue - it doesnt run any of the actions, it just refreshes the screen (what I was explaining in my other post).

    It's maddening lol.

    ------------------------------
    Mike Tamoush
    ------------------------------



  • 7.  RE: New functionaility %%rid%%

    Posted 13 days ago
    Let me try to wrap my head around the process you're doing here, and I'm going to make a couple assumptions that I need you to confirm or correct:

    There's 3 tables being used here:
    Table A: the table that this button is built in and is where you are starting in this workflow.
    Table B: the User Focus table, referenced in the $EditUserFocus variable.
    Table C: the table and form that you're trying to land in after you hit the button in Table A, carrying over the newly created RID for Table A.

    Is this correct?

    ------------------------------
    Brad Lemke
    ------------------------------



  • 8.  RE: New functionaility %%rid%%

    Posted 13 days ago
    Yes that is correct, but the key to it all is - I only have any of the troubles when table A (that I am starting the workflow from) is in Add Record Mode. If the record ID has been created, I can get everything to work properly.

    ------------------------------
    Mike Tamoush
    ------------------------------



  • 9.  RE: New functionaility %%rid%%

    Posted 13 days ago
    Let's see if this works instead (cutting out the genaddrecordform in favor of a=nwr):


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


    var text AddContract = URLRoot() & "db/" & "brgdpr9fn?a=nwr"
    & "&_fid_12=" & URLEncode ([Related Vendor])
    & "&_fid_57=";

    var text EditUserFocus =
    URLRoot() & "db/" & "bp8yr9i5s?a=API_EditRecord" &
    "&key=" & UserToEmail(User()) &
    "&apptoken=xxxxxxxxxxxxxxxxxxxxxxxxx" &
    "&_fid_220=" & [Service Order - SO #] &
    "&_fid_224=" & [Related Service Order];

    "<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='"
    & $EditUserFocus
    & "&rdr=" & URLEncode($AddContract) & $RID
    & "'>Add Subcontract</a>"

    ------------------------------
    Brad Lemke
    ------------------------------



  • 10.  RE: New functionaility %%rid%%

    Posted 13 days ago
    So, it didn't work, but it allowed me to try something interesting (which still doesn't make sense to me and only confirms my intial issue).

    The URL that produced was:
    https://sesgroup.quickbase.com/db/brgdpr9fn?a=nwr&_fid_12=0&_fid_57=

    Which left field 57 blank.
    I manually changed that URL to:
    https://sesgroup.quickbase.com/db/brgdpr9fn?a=nwr&_fid_12=0&_fid_57=%%rid%%

    Which put "id" in field 57. Hmmm...

    ------------------------------
    Mike Tamoush
    ------------------------------



  • 11.  RE: New functionaility %%rid%%

    Posted 13 days ago
    That is odd.  The only other thing I do different in my app/formulas is I actually set up a global variable that I named [NewRID], containing just the pure text with no quotes: %%rid%%



    ------------------------------
    Brad Lemke
    ------------------------------



  • 12.  RE: New functionaility %%rid%%

    Posted 13 days ago
    Thanks, Ill try that and get with customer support if needed. Appreciate your insight.

    ------------------------------
    Mike Tamoush
    ------------------------------



  • 13.  RE: New functionaility %%rid%%

    Posted 6 days ago
    Make sure you make an edit on the add record, then press the button.  Otherwise, it will not work.  This has tripped me up twice now...

    ------------------------------
    Anne Murray
    ------------------------------