You need to sign in to do that
Don't have an account?
Providing the test class for the following trigger...
Hi.. am very new in writing apex code... could anyone please help me out in providing the test class for the following trigger...
Merging MQL Trigger:
trigger MQL on Opportunity (before update)
{
for(Opportunity a : Trigger.new)
{
Opportunity beforeUpdate = System.Trigger.oldMap.get(a.Id);
if(beforeUpdate.StageName =='Lead'||beforeUpdate.StageName == 'Qualified Lead')
{
If(a.StageName != 'Lead' && a.StageName != 'Qualified Lead' && a.StageName != 'No Opportunity')
{
a.MQL_Promotion_Date__c = System.today();
system.debug('*** Oppty changed from Lead to something other than Lead or No Opportunity - date set to ' + System.today()+' ****');
}
if(a.StageName == 'No Opportunity')
{
a.MQL_Rejection_Date__c = System.today();
system.debug('*** Oppty changed from Lead to No Opportunity-date set to'+System.today() +'****');
}
}
}
}
Please anyone provide me the solution.
Thank you.
See if this works:
hi can anyone please write a test class in which u query an opportunity by name or id
Then update the Opp’s Stage name (input will be the one of the stagename) and output would be the updation to the dates ie.. to the promotion date and rejection date based on the condition thats is given in the trigger.
thank you
What no thank you for the above code? Did it even work? Why not make a new post for your new request? Also if the above code worked, please check this thread as having a solution.