You need to sign in to do that
Don't have an account?
Christiaan
Help with test script for the first apex trigger I have build
Hello,
I have written my first apex trigger, but I didn't know that I also need a test script before i can implement it. I'm very new to this so i'm wondering if someone could help me with the test script:
The trigger is as followed:
trigger setPriceBook on Opportunity (before insert, before update) { ID PRICEBOOK_FRAMEWORK = '01sR00000000EtRIAU'; ID PRICEBOOK_PROJECTEN_AO_LICENTIES = '01sR00000000EtWIAU'; ID REC_TYPE_FRAMEWORK = '012R00000004Ykf'; ID REC_TYPE_PROJECTEN_AO_LICENTIES = '012R00000004Ykk'; for( Opportunity oppty : trigger.new ) { if ( oppty.type == 'Framework Agreement') { oppty.Pricebook2Id = PRICEBOOK_FRAMEWORK; } else if ( oppty.type == 'Projecten') { oppty.Pricebook2Id = PRICEBOOK_PROJECTEN_AO_LICENTIES; } else if ( oppty.type == 'Application Outsourcing') { oppty.Pricebook2Id = PRICEBOOK_PROJECTEN_AO_LICENTIES; } else if ( oppty.type == 'licenties') { oppty.Pricebook2Id = PRICEBOOK_PROJECTEN_AO_LICENTIES; } } }
Can someone help me with the test script?
With kind regards,
Christiaan
http://wiki.developerforce.com/index.php/An_Introduction_to_Apex_Code_Test_Methods
This link was very helpful when I wrote my first test methods.