Add Child Record from Gen Add Record Form and View Child Record

  • 0
  • 1
  • Question
  • Updated 5 months ago
  • Answered
Hello,

I have a process where users will add a new record and then from that add record form they need to be able to add a child record and have that parent record ID be related to that child record.  Once they save the child record it should show the child record in view mode.  As of right now it returns to the parent record in edit mode.

My questions are:
1.  How do I pass the related parent record id to the child record from an add record screen?
2. How do I view the child record after saving the child record?

Thanks all!
Photo of Jacob

Jacob

  • 738 Points 500 badge 2x thumb
  • frustrated

Posted 8 months ago

  • 0
  • 1
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 51,046 Points 50k badge 2x thumb
I think that this is low tech.

Go to the settings for the Parent table, Advanced Settings and check the box for

"Save Parent record automatically when a child record is added."

Then the default behaviour will be to return to the Parent record after saving the Child.

If you want to stick on view mode on the child after saving, then edit the Add Child code to comment out or remove that last part which says 

& "&z=" & Rurl()
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 51,046 Points 50k badge 2x thumb
ie you can be in Add mode and Add Child and the Parent record will save automatically and the child will automatically connect to the Parent.
Photo of Kelly

Kelly

  • 1,762 Points 1k badge 2x thumb
Mark, my child record saves and returns back to the parent, but in edit mode. I can't seem to make it go back in display mode. Here is my code:

URLRoot() & "db/" & [_DBID_RUN__REQUESTS] & "?a=API_GenAddRecordForm&dfid=11&_fid_12=" & ([Tracking#]) & "&rdr="& "&z=" & Rurl()
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 51,046 Points 50k badge 2x thumb
I don't know of a way to return the user to the parent record in View mode.  It return you to the Parent record in the state it was in when you left it, which was edit mode (well, actually add mode), but in a typical situation the User is working their way  down a long form and filling in fields and adding children record as they go.  ie there could be multiple child tales they are completing as they work their way though the parent form.

If you want to ensure that the user is returned the the Parent record in View mode, then the add child button would need to be clicked in view mode, so you would need to suppress the Add Child button from appearing in edit or add modes on the form.
Photo of Kelly

Kelly

  • 1,762 Points 1k badge 2x thumb
Well that makes sense! I can't believe I didn't realize that... Thank you!