
1 risposta
HI Junkiy,I saw your trigger is not followed by best practice of salesforce ,you should not query inside for loop .try to create some map and make the query out side loop . I dont think query is required here any way query will not return any thing incae of before insert .I think below code will help for you .
For test class you need to just insert Issuer__c records and update .Your code is simple ,try to follow below and start writting test class . Whats the problem you are facing ? http://manojjena20.blogspot.com/2015/06/tips-and-tricks-for-test-class.html (http://Whats the problem you are facing ? Try to floow below links it will help . http://manojjena20.blogspot.com/2015/06/tips-and-tricks-for-test-class.html (https://trailhead.salesforce.com/en/content/learn/modules/apex_testing/apex_testing_intro) https://trailhead.salesforce.com/en/content/learn/modules/apex_testing/apex_testing_intro Try to run the test class in you rorganisation , you can install code coverage calculator chrome extension which will help you to identify the line which covered . Thanks , Manoj) https://trailhead.salesforce.com/en/content/learn/modules/apex_testing/apex_testing_introhttps://trailhead.salesforce.com/en/content/learn/modules/apex_testing/apex_testing_introTry to run the test class in you rorganisation , you can install code coverage calculator chrome extension which will help you to identify the line which covered .Thanks ,Manojtrigger IssuerUpdate on Issuer__c (before insert,before update){
//Recursive Trigger So using this
if(trigger_handler.runOnce()){
for(Issuer__c n : trigger.new){
//Checking the Condtion Status Feild
if(n.Status__c== 'Approved'){
n.RevQ0__c=0;
n.RevQ3__c= n.RevQ1__c;
n.RevQ2__c= is.RevQ1__c;
n.RevQ3__c=is.RevQ2__c;
n.RevQ4__c=is.RevQ3__c;
}
}
}
}