Discussions

 View Only
  • 1.  Add Child Record, then edit that child record, then redirect to edit form of child record

    Posted 06-08-2022 12:56
    I feel like this should be easy but I'm drawing a blank. I have a situation where, when a child record (media) gets created via button, the user has to save the record after making their changes, then edit it again to update 1 last field. This is because that last field needs to be populated with a location path that contains the record ID of the child media record, which doesn't exist yet when they click the button to add the media. So it just creates a few extra clicks that shouldn't really be necessary. 
    So I'm trying to tweak the button to create the media from the parent (request), then edit that same media record by populating a text field with "some string" & the newly created RID for this child media record. Lastly, after adding & editing the record, I'll have it redirect to the edit form of the media so the user can make their edits as necessary.

    ------------------------------
    Harrison Smith
    ------------------------------


  • 2.  RE: Add Child Record, then edit that child record, then redirect to edit form of child record

    Posted 06-08-2022 13:16
    You will need to use the Rich Text "Save Before Navigating" syntax to hold of that Newly created Record ID#

    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



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



  • 3.  RE: Add Child Record, then edit that child record, then redirect to edit form of child record

    Posted 06-08-2022 13:55
    Thanks Mark, knew you'd have a quick response. Unfortunately I'm getting an error saying "sorry, there is no record in this application table with the record identifier (rid) of "0".

    This is the code for my button as it stands now:

    var text rid = "%%rid%%";
    var text Token = my app token;
    var text CreateMedia = URLRoot() & "db/" & [_DBID_MEDIA] & "?a=API_GenAddRecordForm&apptoken=" & $Token & "&_fid_7=" & URLEncode([Record ID#]);
    var text UpdateMedia = URLRoot() & "db/" & [_DBID_MEDIA] & "?a=API_EditRecord&apptoken=" & $Token & "&RID=" & $rid & "&_fid_14=testingAddRID" & $rid;
    var text URL = $CreateMedia & "&rdr=" & URLEncode($UpdateMedia) & $RID;


    "<a class='Vibrant Primary SaveBeforeNavigating' data-replaceRid=true href='" & $url & "'>Add Matter, Update New Matter, Return to Edit New Matter</a>"

    ------------------------------
    Harrison Smith
    ------------------------------



  • 4.  RE: Add Child Record, then edit that child record, then redirect to edit form of child record

    Posted 06-08-2022 18:26
    What you want to do is to ADD Media totally normally.  Use the usual add child button that Quickbase created for you, but without the "&z=Rurl() part.

    Then create a button to on the Media record to show in ADD and Edit mode which you will use instead of the native green SAVE button.  Call it like "Save and Continue Editing".

    var text RID = IF([Record ID#]>0, [Record ID#], %%RID%%);

    var text URL = URLRoot() & "db/" & [_DBID_MEDIA] & "?a=er&rid=" & $RID;


    "<a class='Vibrant Primary SaveBeforeNavigating' data-replaceRid=true href='" & $URL & "'>Save and Continue Editing"</a>"



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