Forum Discussion

manoharvankired's avatar
manoharvankired
Qrew Trainee
2 years ago

I am receiving an error when attempting to use a formula without saving the record in the 'In Progress' table (B). However, once I save the record in the 'In Progress' table (B), the same formula works fine.

I have two tables. I added a new record to the 'New Request' table (A) using the Quickbase auto-generate API button, and then attempted to add the same record to the 'In Progress' table (B) by clicking on the API button. However, I received an error message stating that the 'rid' parameter was missing.
'In Progress' table (B) formula= "If(IsNull([Start Date]),
URLRoot() & "db/" & [_DBID_INPROGRESS] & "?act=API_EditRecord&apptoken=dpvtvtrbuvtrjjd5ydp38bccn9np&rid=" & [Record ID#] & "&_fid_45=" & URLEncode("Task Started") & "&_fid_6=" & Now() & "&rdr=" & URLEncode(URLRoot() & "db/" & [_DBID_INPROGRESS] & "?act=dr&rid=" & [Record ID#]) )"
 
Note: I am receiving an error when attempting to use a formula without saving the record in the 'In Progress' table (B). However, once I save the record in the 'In Progress' table (B), the same formula works fine


------------------------------
manohar vankireddy
------------------------------
  • katlyncowley's avatar
    katlyncowley
    Qrew Assistant Captain

    The record ID (or rid) is not assigned until the record is saved for the first time. 



    ------------------------------
    Katlyn Allen
    kallen@eatatjacks.com
    ------------------------------
    • MarkShnier__You's avatar
      MarkShnier__You
      Icon for Qrew Legend rankQrew Legend

      This can be done using the SaveBeforeNavigating syntax but I would have to find time to write this up. I'm busy with taxes and other client work.



      ------------------------------
      Mark Shnier (Your Quickbase Coach)
      mark.shnier@gmail.com
      ------------------------------
  • Don't have a lot of time either, but as everyone says - the record ID does not exist until saved. Luckily, during an add record, when using a custom button on that sheet, you can use the %%rid%% and SaveBeforeNavigating commands to capture the newly saved record ID. Basic button code below, you would just need to sub in your information. This would use a formula rich text field.

    var text RID = If([Record ID#]>0, ToText([Record ID#]), "%%rid%%");

    var text EditRecord = URLRoot() & "db/" & dbid() & "?act=API_EditRecord"
    & "&apptoken= xxxxxx" // if you have the need for Application Tokens enabled.
    & "&rid=" & ToText($RID)
    & "&_fid_99=now"; // sets this field to current date time but you can set any fields you need as typical 

    var text DisplayRecordButMissingRID = URLRoot() & "db/" & dbid() & "?a=dr&rid=";

    var text URL =
    $EditRecord
    & "&rdr=" & URLEncode($DisplayRecordButMissingRID) & $RID; // the %%RID%% does not like being URLEncoded.

    //below makes the button. Save before navigating and data-replaceRID=true are the important bits

    "<a class='SaveBeforeNavigating' data-replaceRid=true style=\"text-decoration:none; background: #1ba802; border-radius: 5px; color: #ffffff; display: inline-block; padding: 2px 2px 2px 2px; width:200px; text-align: center; text-shadow: none; border: 2px solid #1ba802; font-size: 18px \"href='"
    & $URL
    & "'>Button Words Here</a>"



    ------------------------------
    Mike Tamoush
    ------------------------------
    • manoharvankired's avatar
      manoharvankired
      Qrew Trainee

      Hi Mike,

      Im getting error, The Application Token dpvtvtrbuvtrjjd5ydp38bccn9np has not been assigned to this Application. To read about assigning an Application Token to your application go to https://help.quickbase.com/user-assistance/app_tokens.html

      Same Api I'm using across the application but it is working fine

      Thanks
      Manohar



      ------------------------------
      manohar vankireddy
      ------------------------------
      • MikeTamoush's avatar
        MikeTamoush
        Qrew Commander

        Application tokens are an extra level of security, so it is best practice not to post the tokens in this forum (or any place public).

        Regarding the error, that must mean that either there is a typo in the application token, or you have used the token in a different application, but not this one - and the token is not assigned to this particular app. Go to your settings, manage application tokens and double check the token exists and is typed correctly (no accidental spaces or anything in your code either).  If both of those things are true, then I would put in a customer support ticket.



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