How to Ensure Child Record is added before Saving parent?

  • 0
  • 1
  • Question
  • Updated 3 years ago
  • Answered

I have a parent form with a child form.  I just want to ensure that before parent is saved, user is always forced to add a child record.  To get around this, I created a summary field of max of record ID from the child table to check if there indeed exists a child record and if not user is forced to add one before saving parent record. Then I added a form rule in the parent form so that  when parent record is saved, it checks if the max of child ID record is not blank and abort the save. 

Even after doing all this (and provided I got right), I constantly get a message even if I am trying to add child record by clicking add button that my max of record ID is blank and I need to add a child record.  Is  this the right approach? 

Photo of Arshad Khwaja

Arshad Khwaja

  • 3,152 Points 3k badge 2x thumb

Posted 3 years ago

  • 0
  • 1
Photo of dwhawe

dwhawe, Champion

  • 908 Points 500 badge 2x thumb
A Child record is linked to the Parent by the value of the Parent's Key Field which in this case I am assuming is the Record ID.

Since the Parent does not actually exist until it has been saved, there is no way to link a Child to the Parent until AFTER the Parent has been created.  Remember that the record does not exist until saved rather than merely when data has been entered into a form.

All that to say that your Max of Record ID is blank because none yet exists.
Photo of Arshad Khwaja

Arshad Khwaja

  • 3,152 Points 3k badge 2x thumb
Thanks. But if I have chosen to save the record before creating the child as part of the parent table property, should I still not be able to force user to create a child record? ,
You may have to settle for warnings on Parents with no Children supported by email Notification on save (not tested) and a daily subscription to the [Record Owner] of the Parent to record telling them each day to Create a Child! or else bad luck and Management displeasure will befall them.
Photo of Arshad Khwaja

Arshad Khwaja

  • 3,152 Points 3k badge 2x thumb
OK thanks.  I liked the last option.  Cheers.