function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Priyesh Misquith 12Priyesh Misquith 12 

single trigger to update account and Opportunity and vice versa

Hello,
I need help for the following trigger scenario:

There is one field in Account and one field in Opportunity 
Consider the field in Account is FieldA and the Field in the Opportunity is FieldB (consider both fields are check-box)
when i Update the fieldA in Account, the fieldB in Opportunity should get updated and
when i Update the fieldB in Opportunity, the fieldA in account should get Updated.

Thank you 
Raj VakatiRaj Vakati
You can not able to do with single triggers 


You need to create two triggers and make sure you are avoiding the recursive trigger
Ajay K DubediAjay K Dubedi
Hi Priyesh,

 It will not be possible with a single trigger, For this you have to create two triggers. 
 One trigger on Account object which will Update the fieldA in Account, the fieldB in Opportunity should get updated.
 Another trigger on opportunity object which will Update the fieldB in Opportunity, the fieldA in the account should get Updated.
 Also, make sure you are avoiding the recursive trigger.

Please mark this as Best Answer if you find this solution helpful.

Thank You
Ajay Dubedi