Parent/Child Record Relationship

  • 0
  • 1
  • Question
  • Updated 5 months ago
  • Answered
Is there a way to prevent the deletion of a parent record if  child records exist?
Photo of Bradley Damron

Bradley Damron

  • 320 Points 250 badge 2x thumb

Posted 6 months ago

  • 0
  • 1
Photo of QuickBasePros_IDS

QuickBasePros_IDS, Champion

  • 2,266 Points 2k badge 2x thumb
There was a similar post last week about customizing how records are deleted.  My solution was to indicate records should be deleted and have someone else do the deletion as a double-check.  Mark Shnier suggested "marking" a record for deletion and then using an automation to actually perform the deletion - within which you can build rules etc.  So, for example a user would click a button to "delete" the record; but it would only delete via the automation if there were no children.  Also, you could have a second-automation that if the "delete" marker was populated and there were children; it would "undo" the marker field (checkbox, date field etc.)
Photo of Bradley Damron

Bradley Damron

  • 320 Points 250 badge 2x thumb
Thanks, but in this case I don't want to allow the user to delete the parent record if children exist. 
Photo of Jim Harrison

Jim Harrison

  • 1,770 Points 1k badge 2x thumb
If you pass a summary up to the parent and it is populated that means there is at least one child record. Using the summary field you can do the following.
Remove all QB delete & grid edit controls.
On the parent add a check box named delete.
Put a form rule that prompts the user if there are child records or hide the delete checkbox until there are no child records.
Modify default reports to filter for delete check box.
Set up a weekly automation or do it manually to remove the deleted parents.