You need to sign in to do that
Don't have an account?
junkiy
not the code coverage the oldmap so help anyone important
trigger IssuerUpdate on customer__C (before insert,before update)
{
//Public Static boolean makeempty = true;
Set<Id> trendsid = new Set<Id>();
if(trigger_handler.runOnce()){
for(customer__C n : Trigger.New)
{
trendsid.add(n.Id);
if(n.Status__c== 'Approved'){
// after changes status Approved data transfer 0 to 1;
n.RevQ1__c= n.RevQ0__c;
//all '0' values are null;
n.RevQ0__c=null;
customer__C oldOpp = Trigger.oldMap.get(n.Id);
//based on time period chnages the values
n.RevQ2__c= oldOpp.RevQ1__c;
n.RevQ3__c= oldOpp.RevQ2__c;
n.RevQ4__c= oldOpp.RevQ3__c;
}
}
}
}
{
//Public Static boolean makeempty = true;
Set<Id> trendsid = new Set<Id>();
if(trigger_handler.runOnce()){
for(customer__C n : Trigger.New)
{
trendsid.add(n.Id);
if(n.Status__c== 'Approved'){
// after changes status Approved data transfer 0 to 1;
n.RevQ1__c= n.RevQ0__c;
//all '0' values are null;
n.RevQ0__c=null;
customer__C oldOpp = Trigger.oldMap.get(n.Id);
//based on time period chnages the values
n.RevQ2__c= oldOpp.RevQ1__c;
n.RevQ3__c= oldOpp.RevQ2__c;
n.RevQ4__c= oldOpp.RevQ3__c;
}
}
}
}
I don't know your question or target with the code snippet. Could you explain that in more detail?
One issue I see at the first time is the use for Trigger.oldMap in case of before insert. There is now context variable named Trigger.oldMap for before insert.
See in more detail the following link: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_triggers_context_variables.htm (see table at the top of the page).
Regards,
Chris