You need to sign in to do that
Don't have an account?
V100
Test Class using ReportsTo
I amtrying to write a test class for Contacts code with ReportsTo completed
The code creates a single contact (ignore the test factory piece) and then creates a second contact reporting to the first.
The first and second contacts are created, but the ReportsTo is null on the second.
Contact con1 = Test_Factory.CreateContact(); con1.AccountId = tt.testADP.Customer__c; con1.Contact_Post_Code__c = 'WR5 3RL'; insert con1; Contact con2 = Test_Factory.CreateContact(); con2.AccountId = tt.testADP.Customer__c; con2.Contact_Post_Code__c = 'WR5 3RL'; con2.ReportsTo = con1;
I have tried the variationbut that no longer works
con2.ReportsToId = con1.Id;
There was a similar issue raised:
That shows a work around, however this is for a test class so cannot really work around.
Are there problems writing to this field via Apex or have a i got something wrong.
Any help much appreciated.
This works for me...
All Answers
This works for me...
and me too, not sure where i went wrong though, but thanks :-)