trigger DocusignExpirationDate on dsfs__DocuSign_Status__c (after update) {
List<Quote> Docusign = new List<Quote>();
set<Id> quoteid =new set<Id>();
set<Id> oppId = new set<Id>();
set<Id> envelopeId = new set<Id>();
List<Opportunity> oppListUpdate =new List<Opportunity>();
map<ID,dsfs__DocuSign_Status__c> docSignMap = new map<ID,dsfs__DocuSign_Status__c>();
for(dsfs__DocuSign_Status__c Expdate:Trigger.new){
if(Expdate.Quote__c !=null)
quoteid.add(Expdate.Quote__c);
}
list<Quote> QuoteList = [select id,name,ExpirationDate,Opportunityid from Quote where id IN :quoteid];
system.debug('/////////////'+QuoteList );
for(Quote qu :QuoteList ){
if(qu.Opportunityid !=null){
oppId.add(qu.Opportunityid );
}
qu.ExpirationDate =date.valueof(System.now());
Docusign.add(qu);
system.debug('////rrrrrr/////////'+Docusign);
}
List<Opportunity> oppList = [select id,StageName from Opportunity where id in:oppId];
for(Opportunity op:oppList ){
op.stageName = 'Proposal/Price Quote';
oppListUpdate.add(op);
}
update oppListUpdate;
update Docusign;
}
No comments:
Post a Comment