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
Radhe ShyamRadhe Shyam 

Need a trigger to update record

i have 2 objects, Opportunity and CustomOpportunity(custom obj.) . I want to write a trigger, if i create a record on Opportunity, then one record should be created on CustomOpportunity and if i edit the record, the changes should be reflect on the record of Customopportunity object and vice versa.

 
shashi lad 4shashi lad 4
If i understand correctly, You want to insert/update record both ways and synchronize the changes. You need to develop triggers on both objects but tricky part is it is going to generate recursive trigger issue. When you update on one, it will fire on another one and that will make first trigger fire again. Along with triggers you need to use Static variable to stop this. Please refer to this.

https://help.salesforce.com/apex/HTViewSolution?id=000133752&language=en_US

I wonder what is that you are trying to achieve with two identical objects??


thanks
shashi