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
sdjagdja wdguqwesdjagdja wdguqwe 

If i change field

Below code is to autopopulate the fields from Contact to Oppertunity.

If i change any field value in Opportunity record it should update in Opportunity as well as in Contact
For this i need to proceed with event after update.Can u plz guide me how to proceed with after update event

  List<Opportunity> newOpps = new List<Opportunity>();
  for (Contact con : Trigger.new) {
    Opportunity opp = new Opportunity();
    opp.Name        = con.LastName+' Opportunity';
    opp.StageName   = 'Prospecting';
    opp.Status__c = con.Status__c;
    opp.version__c = con.version__c;
    opp.CloseDate   = Date.today() + 90;
   // opp.AccountId   = acc.Id; // Use the trigger record's ID
    newOpps.add(opp);
  }
  if(newOpps.size()>0)
  insert newOpps;
}
  List<Opportunity> newOpps = new List<Opportunity>();
  for (Contact con : Trigger.new) {
    Opportunity opp = new Opportunity();
    opp.Name        = con.LastName+' Opportunity';
    opp.StageName   = 'Prospecting';
    opp.Status__c = con.Status__c;
    opp.version__c = con.version__c;
    opp.CloseDate   = Date.today() + 90;
   // opp.AccountId   = acc.Id; // Use the trigger record's ID
    newOpps.add(opp);
  }
  if(newOpps.size()>0)
  insert newOpps;
}

 
JeeTJeeT
try comparing the old values with new vlaues of the record.
Trigger.oldMap.get(w.id).get(fieldName) with Trigger.newMap.get(w.id).get(fieldName)
OR
For(Integer i = 0; i < Trigger.New.Size(); i++){
  if(Trigger.New[i].FieldName__c != Trigger.Old[i].FieldName__c){
   // Do necessary actions like adding into a list 
  }
}
// Update the LIst
Let me know, for more info.