TRIGGER
trigger accountUpdate on dsfs__DocuSign_Status__c (after insert) {
List<dsfs__DocuSign_Status__c> docStatusList=new List<dsfs__DocuSign_Status__c>();
String OppName;
//Boolean test=false;
Opportunity opLIst=new Opportunity();
List<Id> quoteId = new List<Id>();
if(trigger.isInsert){
for(dsfs__DocuSign_Status__c dStatus:Trigger.new){
quoteId.add(dStatus.Quote__c);
system.debug('DDDDDDDDDDD'+quoteId);
if(quoteId!=null){
Quote quoteRec=[select id, OpportunityId from Quote where id =:quoteId];
OppName=quoteRec.OpportunityId;
system.debug('XXXXXXXXXx'+OppName);
if(OppName!=null)
opLIst=[select id,AccountId from Opportunity where id =:OppName];
system.debug('ZZZZZZZZz'+opLIst);
dsfs__DocuSign_Status__c DD=new dsfs__DocuSign_Status__c();
DD.Id=dStatus.Id;
DD.dsfs__Company__c=opLIst.AccountId;
update DD;
system.debug('EEEEEEEEEE'+DD);
}
}
}
}
trigger accountUpdate on dsfs__DocuSign_Status__c (after insert) {
List<dsfs__DocuSign_Status__c> docStatusList=new List<dsfs__DocuSign_Status__c>();
String OppName;
//Boolean test=false;
Opportunity opLIst=new Opportunity();
List<Id> quoteId = new List<Id>();
if(trigger.isInsert){
for(dsfs__DocuSign_Status__c dStatus:Trigger.new){
quoteId.add(dStatus.Quote__c);
system.debug('DDDDDDDDDDD'+quoteId);
if(quoteId!=null){
Quote quoteRec=[select id, OpportunityId from Quote where id =:quoteId];
OppName=quoteRec.OpportunityId;
system.debug('XXXXXXXXXx'+OppName);
if(OppName!=null)
opLIst=[select id,AccountId from Opportunity where id =:OppName];
system.debug('ZZZZZZZZz'+opLIst);
dsfs__DocuSign_Status__c DD=new dsfs__DocuSign_Status__c();
DD.Id=dStatus.Id;
DD.dsfs__Company__c=opLIst.AccountId;
update DD;
system.debug('EEEEEEEEEE'+DD);
}
}
}
}
No comments:
Post a Comment