You need to sign in to do that
Don't have an account?
hickmand1
Test for basis Apex Trigger
I',m newbie to apex. I've written a basic Apex trigger that creates a new custom record when a Lead is created. I now need to write a test in order to deploy it..... I have no clue where to start. Please help!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | Trigger createAMSLead_c on Lead (after insert) { List <AMS_Leads__c> AMSLeadsInsert = new List <AMS_Leads__c> (); for (Lead o : Trigger.new) { if (o.LeadSource == 'Lead from Med4All website') { AMS_Leads__c v = new AMS_Leads__c (); v.Campaign_Lead_Info__c = o.Id; v.Email_Address__c = o.Email; v.Notes__c = o.Description; v.Home_Work__c = o.Phone; v.Cell_Phone__c = o.MobilePhone; v.Date_Time_of_Response__c = system.NOW(); v.Follow_Up_Method__c = 'Telephonic - Outsource'; AMSLeadsInsert.add(v); } } try { insert AMSLeadsInsert; } catch (system.Dmlexception e) { system.debug (e); } } |
See this develope your test class. If any issue let me know.
http://forceschool.blogspot.com/2011/06/testing-trigger-structure.html