Share Your Experience With Others

Trigger for Multilevel Objects

Suppose you are having this situation:

Multilevel Trigger

  • Account is the parent of opportunity
  • and Opportunity is the parent of Suggestion
  • Now we want to update the same value from Suggestion to Account how we will do that with Trigger. Because Account and Suggestion are not having direct relationship.
  • I have created these fields for testing purpose.
    A Textfield on Account object named grandparent__c
    A Textfield on Suggestion object named SuggestionField__c
  • Now the below trigger i have written and it is performing the output:Trigger new.PNGdebug values

    Source:Trailblazer Community

    Watch below video for more details:

Please share if more optimized code we can write for this.

Leave a comment