I have a child object in a master-detail relationship. If I insert a child record with no parent ID value, but I write a BeforeInsert trigger to populate the parent ID, will Salesforce allow the record to proceed, or does the system reject the record before it reaches the trigger?

1 Answer 1


That should work fine. Looking at the trigger execution order, the "before" triggers execute before any system validation (unless it comes from a standard UI page, which in this case, is impossible as you can't create a record without a parent).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .