[SalesForce] Prevent child records to be created when parent records is submitted for approval

I have a requirement that user can't add child records once the parent records is submitted for approval. In the approval process, parent record gets locked but I also want to prevent child records to be created.

Best Answer

This mechanism will work for both master detail and lookup without resorting to code:

  • Create a new checkbox field on the parent record of 'Locked' or similar with a default value of unchecked.
  • Add an initial submission action on your approval process that sets
    the value of 'locked' to true
  • Add a validation rule to the child record that checks isnew() and the value of the parent's locked field and blocks the the save if it is true.

The advantage to handling this via a validation rule is that you can give the user a friendly error message and attach it to the lookup/master detail field if you want.

Related Topic