Skip to content

Update Parent or related records at once rather than doing multiple times from each triggeraction class #109

@rohithbolla

Description

@rohithbolla

Hey @mitchspano

This is not an issue to report. Im trying to see if we could improve in this aspect.

This is in regards to updating Parent/related objects from 'after update' event in child. For eg. lets say there is a business logic, which is addressed in one of the triggeraction classes on Opportunity object. As per that, if an opportunity is updated for some reason, that should trigger update on Account.

In addition, there is another business logic, which is addressed in another trigger action class for the same Opportunity object. As per this one, if an opportunity is updated with another reason, it should trigger Account update, where the Account Trigger logic, if matches some criteria, should trigger email send.

Since, due to recursion check by idprocessed flag(if we check for count==1), second iteration of account trigger logic would fail and prevents email send. Instead, could all sObjects(accounts here) be consolidated to update at end of each trigger cycle, rather than allowing each business logic to perform dml? Please correct me if I miss something here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions