You need to sign in to do that
Don't have an account?
Test class failed when I activate trigger to test
Dear Friends,
I am trying to test triggers in the Sandbox, I deployed Test Class but when I activate trigger to be tested by that Test Class, my test class fails. It is trowing error as per mentioned in trigger.
E.g. My trigger checks wheather e-mail entered in Lead is already exist in the Lead or contact object. So that my trigger works fine but when I run test class, my test class failed.
What will be the possible cause of such failure of trigger?
Thanks & Regards,
Maddy
Hi Maddy,
can you please post the error message and possible some code for us to look at?
Cheers!
Martin
Thanks Martin for reply. Following is code snippet of my trigger, This trigger basically checks whether entered e-mail in Lead exist in Lead's and Contact's Primary and Secondary Email filed respectively.
I write test class for the same. In that class, I created two lead with same email address to cover above code. So I played with combination of Lead's Primary exist in Lead's secondary and vice vesa.... etc.
But when I run Test Class it failed and gives following Error:
System.DmlException: InsertFailed First Exception on Row 0, First Error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Email already exist for contact: <b><a href="/003T000000rxcDMTAY">Test Name</a></b>: [Email]
Class.TestCkeckOnLead.insertLead3: External Entry Pont
Thanks & Regards,
Maddy.
Can anybody help me?
Thanks & Regards,
Maddy
My trigger contain 'Custome Error Validation'. So whenever I execute my test class to cover code line of 'Custome Error Validation', it throws error of 'FIELD_CUSTOM_VALIDATION_EXCEPTION' for TEST CLASS. How can I get rid from this error message?