Forum Discussion

Re: API_AddRecord and land the user in edit mode.

This should also work to add a child record and land in edit mode on the child.

------------------------------
Mark Shnier (Your Quickbase Coach)
mark.shnier@gmail.com
------------------------------

8 Replies

  • MikeTamoush's avatar
    MikeTamoush
    Qrew Elite
    The posted code does not work for me. I don't think it is saving the new record before the redirect. Then it tries to redirect and says the record does not exist. I can see that it is putting in a blank for the RID.

    I think it would work with NextURL (which defeats the purpose)? I wonder if it would work with API_AddRecord?

    ------------------------------
    Mike Tamoush
    ------------------------------
    • MarkShnier__You's avatar
      MarkShnier__You
      Icon for Qrew Legend rankQrew Legend
      Can I see your code?

      ------------------------------
      Mark Shnier (Your Quickbase Coach)
      mark.shnier@gmail.com
      ------------------------------
      • MikeTamoush's avatar
        MikeTamoush
        Qrew Elite
        This was the code when I was just trying to get it to work in the same table (this said no record found, and doesnt even perform the add record):

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

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

        var text URL =
        $AddRecord
        & "&rdr=" & URLEncode($EditRecord) & $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
        & "'>TestAdd</a>"

        This was the code when trying to use Add Record API in the child table (this adds the record, but has a blank still for RID. I am not sure how I saw before it take the parent record ID):

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

        var text AddRecord =
        URLRoot() & "db/" & [_DBID_SAFETY_ATTENDEES] & "?act=API_AddRecord"
        & "&apptoken=xxxxxxxxxxxxxxxxxxx"
        & "&_fid_11=" & URLEncode([Record ID#]);

        var text EditRecord = URLRoot() & "db/" & [_DBID_SAFETY_ATTENDEES] & "?a=er&rid=" ;

        var text URL =
        $AddRecord
        & "&rdr=" & URLEncode($EditRecord) & $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
        & "'>TestAdd</a>"

        ------------------------------
        Mike Tamoush
        ------------------------------
  • MikeTamoush's avatar
    MikeTamoush
    Qrew Elite
    Update:

    Functionality worked with AddRecordAPI, unfortunately it turns out when launching from the parent, the %%rid%% references the Parent Record ID, rather than the newly created Record ID.

    ------------------------------
    Mike Tamoush
    ------------------------------
    • MarkShnier__You's avatar
      MarkShnier__You
      Icon for Qrew Legend rankQrew Legend
      did you try this?
      var text URL =
      $AddRecord
      & "&NextURL=" & URLEncode($EditRecord) & $RID;

      ------------------------------
      Mark Shnier (Your Quickbase Coach)
      mark.shnier@gmail.com
      ------------------------------
      • MikeTamoush's avatar
        MikeTamoush
        Qrew Elite
        Yes. Interestingly, still no luck. I am wondering if I need GenRecordAdd form. But either way, if I use NextURL it defeats the purpose, because the goal is the user doesnt stop on add record. The goal is the record is quickly added in the background, and then the user lands in edit mode on the record. To the user, they are adding a record, they just dont realize the Record ID now already exists.

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