You need to sign in to do that
Don't have an account?
Vidhyasagar Ranganathan
Update custom object with opportunity data
Hi All,
I am looking for some help for an one off apex class that would update the opportunity details in custom object. The custom object has the opportunity ID.
Thank you.
I am looking for some help for an one off apex class that would update the opportunity details in custom object. The custom object has the opportunity ID.
Thank you.
-------------------
trigger UpdateOpty on YouCustomObject (after update) {
List <Opportunity> oppToUpdate = new List <Opportunity> ();
for (YouCustomObject eachRecordOfCustomObject : Trigger.new) {
// you can put any criteria to filter
if (eachRecordOfCustomObject.SAL__c==True) {
Opportunity o = new Opportunity ();
o.Name = m.Name;
o.StageName = 'Generate Opportunity';
o.Type = 'Sales - New Business';
o.CloseDate = System.Today()+150;
oppToUpdate.add(o);
}// end if
}// end for
if(!oppToUpdate.isEmpty()){
update(oppToUpdate);
}
}// end trigger
--------------------
If you want to update custom object from opportunity then you can write a trigger on the opportunity and do the same as above.
Please mark it best if it helps you. Thanks in advance.
Regards,
Pawan Kumar