Forum Discussion

BradleyDamron's avatar
BradleyDamron
Qrew Cadet
6 years ago

Parent/Child Record Relationship

Is there a way to prevent the deletion of a parent record if  child records exist?

3 Replies

  • 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.)
  • Thanks, but in this case I don't want to allow the user to delete the parent record if children exist. 
  • 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.