You need to sign in to do that
Don't have an account?
Terry411
Test Task Trigger
I have a trigger on Task (after insert, after update) that I'm attempting to create test code for. Below is a partial snapshot of the test class.
... Lead l1001b = new Lead(Company='Test1001b', LastName='Test1001b', OwnerID=UserId, NumberOfEmployees=1001); Lead[] ld = new Lead[] {l1001b}; insert ld;
Where I'm having trouble is, I need to create a Task that is associated to the Lead record however, I receive the error "Field is not writeable: Who" with the syntax I have below.
... Task t1001b = new Task(Who=l1001b, Owner=UserId, Subject='Call', Status='Completed', Priority='Normal'); Task[] t = new Task[] {t1001b}; insert t;
I need to be able to create Tasks assocated to Leads and Contacts in order to adequately test my trigger. Can anyone point me in the right direction?
Does WhoID work?