Discussions

 View Only
Expand all | Collapse all

API_AddRecord and land the user in edit mode.

  • 1.  API_AddRecord and land the user in edit mode.

    Posted 11-16-2021 13:05
    This works to works to create a record and land the user in View mode.

    URLRoot() & "db/" & [_DBID_SKTDS] & "?act=API_AddRecord"
    & "&_fid_6=" & URLEncode([Supplier])
    & "&disprec=1";


    Is there any way to land the user in edit mode?


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


  • 2.  RE: API_AddRecord and land the user in edit mode.

    Posted 12-02-2021 14:23
    We are currently trying to do the same thing with no success, use a Formula URL field to call API_AddRecord then redirect to Edit mode of the new record. I was hoping to use %%rid%% in the redirect URL but that errors out. The "&disprec=1" does not work either, it sends me to the XML response from the API_AddRecord instead of View mode.

    Has anyone been able to figure this one out in the couple weeks since this was originally posted?

    ------------------------------
    Oana Toma
    ------------------------------



  • 3.  RE: API_AddRecord and land the user in edit mode.

    Posted 12-02-2021 14:29
    I've seen some solution used by someone else where there is a helper table that calcs max RID, then if you add 1 to that it should relay to the newest record if used in a formula URL w/ a=er and RID=Maxrecord+1. 

    Have not tested this, but don't see why it would not work.

    ------------------------------
    Melissa Doran
    Jr Solutions Consultant
    Quandary Consulting Group

    linkedin.com/in/melissardoran
    mdoran@quandarycg.com
    ------------------------------



  • 4.  RE: API_AddRecord and land the user in edit mode.

    Posted 12-02-2021 17:13
    What is the error you get with %%rid%%. Ive only used it once I think, but I remember having success? Perhaps I only used it in GenAddRecord.....

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



  • 5.  RE: API_AddRecord and land the user in edit mode.

    Posted 12-02-2021 17:12
    what is the &disprec=1 ? Is that new?

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



  • 6.  RE: API_AddRecord and land the user in edit mode.

    Posted 12-02-2021 17:25
    &disprec=1 is not new.

    It's a parameter that basically says when you get done adding the record then display the record equals true.  In  other words land the user on the record in View mode.

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



  • 7.  RE: API_AddRecord and land the user in edit mode.

    Posted 05-03-2022 11:45
    Just x referencing to a solution.

    https://community.quickbase.com/communities/community-home/digestviewer/viewthread?MessageKey=4466dd0f-403f-4f24-94d8-4ac7128081ae&CommunityKey=d860b0f8-6a48-487b-b346-44c47a19a804&tab=digestviewer#bm4466dd0f-403f-4f24-94d8-4ac7128081ae


    Just posting some code that worked. The goal was to add a record and return the user to the added record in Edit mode.

    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 use case might be to land the user on a saved record so that the Report Link fields would immediately populate.

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



  • 8.  RE: API_AddRecord and land the user in edit mode.

    Posted 01-05-2023 16:37
    Mark,

    Did you ever figure out how to land in edit mode, if the add record is in a different table than the URL button?

    & "&disprec=1";  This worked for me to land in view mode, even when adding a child. But I think the solution posted above will only work if you are adding a record to the table you are in, right? Not if you are adding a child?

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



  • 9.  RE: API_AddRecord and land the user in edit mode.

    Posted 01-05-2023 16:51
    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
    ------------------------------



  • 10.  RE: API_AddRecord and land the user in edit mode.

    Posted 01-05-2023 18:46
    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
    ------------------------------



  • 11.  RE: API_AddRecord and land the user in edit mode.

    Posted 01-05-2023 18:53
    Can I see your code?

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



  • 12.  RE: API_AddRecord and land the user in edit mode.

    Posted 01-05-2023 19:08
    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
    ------------------------------



  • 13.  RE: API_AddRecord and land the user in edit mode.

    Posted 01-05-2023 18:50
    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
    ------------------------------



  • 14.  RE: API_AddRecord and land the user in edit mode.

    Posted 01-05-2023 19:28
    did you try this?
    var text URL =
    $AddRecord
    & "&NextURL=" & URLEncode($EditRecord) & $RID;

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



  • 15.  RE: API_AddRecord and land the user in edit mode.

    Posted 01-05-2023 19:34
    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
    ------------------------------



  • 16.  RE: API_AddRecord and land the user in edit mode.

    Posted 01-05-2023 19:44
    Edited by Mike Tamoush 01-05-2023 19:48
    My theory is that in order to take advantage of the %%rid%% functionality, you need to be in an add record, then be pushing a button and you can grab the record ID of the source (launch) record.

    But i dont think you can create a new record, and get the new record ID of the record you just created, you gotta press a rich text button inside that add (new) record.

    I have this in my notes, which I believe was from the release notes:

    "Use record ID# as a parameter when you click a custom hyperlink from an add record form. "

    So this would confirm that the basic concept wont work.
    ------------------------------
    Mike Tamoush
    ------------------------------



  • 17.  RE: API_AddRecord and land the user in edit mode.

    Posted 11-02-2023 22:32

    If anyone comes across this in the future, check out the CreateChildSaveAndEdit (CODE PAGE) on Kirk Trachy's Magic Buttons app.



    ------------------------------
    Michael Frishman
    ------------------------------