You need to sign in to do that
Don't have an account?
Somasundaram S 1
test class for trigger for oldmap
how to write test class for below trigger for oldmap please advise me
trigger cus on Sample_Transaction__c(before update) {
Call2__c Objopp;
Map<Id,Sample_Transaction__c> o = new Map<Id,Sample_Transaction__c>();
o = trigger.oldMap;
ApexPages.StandardController controller = new ApexPages.standardController(Objopp);
UnlockRecordDuringApprovalCon ObjUnlock= new UnlockRecordDuringApprovalCon(controller);
for (Sample_Transaction__c objCustomer: Trigger.new) {
if (objCustomer.Status__c== 'Active') {
if(objCustomer.Status__c!= o.get(objCustomer.Id).Status__c) {
List<String> s = new List<String>{objCustomer.Call_ID__c};
for(Call2__c c: [SELECT id FROM Call2__c WHERE Name IN :s]){
ObjUnlock.processRecord(c.id );
}
}
}
}
}
trigger cus on Sample_Transaction__c(before update) {
Call2__c Objopp;
Map<Id,Sample_Transaction__c> o = new Map<Id,Sample_Transaction__c>();
o = trigger.oldMap;
ApexPages.StandardController controller = new ApexPages.standardController(Objopp);
UnlockRecordDuringApprovalCon ObjUnlock= new UnlockRecordDuringApprovalCon(controller);
for (Sample_Transaction__c objCustomer: Trigger.new) {
if (objCustomer.Status__c== 'Active') {
if(objCustomer.Status__c!= o.get(objCustomer.Id).Status__c) {
List<String> s = new List<String>{objCustomer.Call_ID__c};
for(Call2__c c: [SELECT id FROM Call2__c WHERE Name IN :s]){
ObjUnlock.processRecord(c.id );
}
}
}
}
}
Are you abe to achieve the desired functionality through the Apex trigger code you have written?
Try this code for you Test Class :
Please let me kknow if this helps!
Thanks,
Apoorv