You need to sign in to do that
Don't have an account?
vivek singh08481200707119766
Hi please help me this is a triger how we make its test class i m new in salesforce
trigger chekDocSign on dsfs__DocuSign_Recipient_Status__c (After insert, After update) {
for(dsfs__DocuSign_Recipient_Status__c ob :trigger.new){
if(ob.dsfs__Date_Signed__c != null){
dsfs__DocuSign_Recipient_Status__c objDRS = [select dsfs__Parent_Status_Record__r.dsfs__Opportunity__r.id from dsfs__DocuSign_Recipient_Status__c where id =: ob.Id limit 1];
Opportunity objOpp = [select id, StageName from Opportunity where id =: objDRS.dsfs__Parent_Status_Record__r.dsfs__Opportunity__r.id limit 1];
objOpp.StageName = 'Closed Won - Signed';
update objOpp;
}else{
if(ob.dsfs__Date_Declined__c != null){
dsfs__DocuSign_Recipient_Status__c objDRS = [select dsfs__Parent_Status_Record__r.dsfs__Opportunity__r.id from dsfs__DocuSign_Recipient_Status__c where id =: ob.Id limit 1];
Opportunity objOpp = [select id, StageName from Opportunity where id =: objDRS.dsfs__Parent_Status_Record__r.dsfs__Opportunity__r.id limit 1];
objOpp.StageName = 'Closed Lost (Cancelled)';
update objOpp;
}
}
}
}
for(dsfs__DocuSign_Recipient_Status__c ob :trigger.new){
if(ob.dsfs__Date_Signed__c != null){
dsfs__DocuSign_Recipient_Status__c objDRS = [select dsfs__Parent_Status_Record__r.dsfs__Opportunity__r.id from dsfs__DocuSign_Recipient_Status__c where id =: ob.Id limit 1];
Opportunity objOpp = [select id, StageName from Opportunity where id =: objDRS.dsfs__Parent_Status_Record__r.dsfs__Opportunity__r.id limit 1];
objOpp.StageName = 'Closed Won - Signed';
update objOpp;
}else{
if(ob.dsfs__Date_Declined__c != null){
dsfs__DocuSign_Recipient_Status__c objDRS = [select dsfs__Parent_Status_Record__r.dsfs__Opportunity__r.id from dsfs__DocuSign_Recipient_Status__c where id =: ob.Id limit 1];
Opportunity objOpp = [select id, StageName from Opportunity where id =: objDRS.dsfs__Parent_Status_Record__r.dsfs__Opportunity__r.id limit 1];
objOpp.StageName = 'Closed Lost (Cancelled)';
update objOpp;
}
}
}
}
You can try something like this:
I would also suggest you to go through this link for more help on test classes: https://developer.salesforce.com/page/How_to_Write_Good_Unit_Tests
If this answers your question, please mark this as the Best Answer for this post, so that others can benefit from this post.
Thanks,
Shashank