Trigger.
trigger DocusignstageupdateEnvelopeStatus on dsfs__DocuSign_Status__c (after update) {
// List<dsfs__DocuSign_Status__c> oppListnew = new List<dsfs__DocuSign_Status__c>();
List<Opportunity> oppListnew = new List<Opportunity>();
set<Id> oppIds = new set<Id>();
for(dsfs__DocuSign_Status__c dc:trigger.new){
if(dc.dsfs__Envelope_Status__c!=null)
oppIds.add(dc.dsfs__Envelope_Status__c);
}
List<Opportunity> oppList = [select id, Name , StageName from Opportunity where id IN:oppIds];
for(Opportunity op : oppList){
op.StageName ='Closed Won';
oppListnew.add(op);
}
update oppListnew;
}
trigger DocusignstageupdateEnvelopeStatus on dsfs__DocuSign_Status__c (after update) {
// List<dsfs__DocuSign_Status__c> oppListnew = new List<dsfs__DocuSign_Status__c>();
List<Opportunity> oppListnew = new List<Opportunity>();
set<Id> oppIds = new set<Id>();
for(dsfs__DocuSign_Status__c dc:trigger.new){
if(dc.dsfs__Envelope_Status__c!=null)
oppIds.add(dc.dsfs__Envelope_Status__c);
}
List<Opportunity> oppList = [select id, Name , StageName from Opportunity where id IN:oppIds];
for(Opportunity op : oppList){
op.StageName ='Closed Won';
oppListnew.add(op);
}
update oppListnew;
}
No comments:
Post a Comment