You need to sign in to do that
Don't have an account?
Elkay
Cross Object Trigger - AddError
Hi there,
I have an after insert trigger on child object the updates a field in parent object. I am using Database.saveresult[] uResult = database.update(rAccList,false); to update the account records and in case of failure at the ID of failed accounts in a Map. Search for child object wherein account.Id is in the failed map and then use AddError. This functionality works fine, however this results in the failure of insertion of all child records where accountId is in the Map. Is there a way to get the Id of the child record that caused the validation failure in the parent object and then use addError only for that child record.
Thank you.
Elkay
I have an after insert trigger on child object the updates a field in parent object. I am using Database.saveresult[] uResult = database.update(rAccList,false); to update the account records and in case of failure at the ID of failed accounts in a Map. Search for child object wherein account.Id is in the failed map and then use AddError. This functionality works fine, however this results in the failure of insertion of all child records where accountId is in the Map. Is there a way to get the Id of the child record that caused the validation failure in the parent object and then use addError only for that child record.
Thank you.
Elkay
If this answers your question, please mark this as the Best Answer for this post, so that others can benefit from this post.
Thanks,
Shashank