You need to sign in to do that
Don't have an account?
Madhulendra
Getting problem to wirte Test Class for this Trigger
I am getting problem to write Test class for given trigger can anybody help me
here is my trigger
trigger TriggerAfterLeadConversion on Lead (after update)
{
for(Lead lead:Trigger.new){
if (Lead.IsConverted){
Contact con = [SELECT Id FROM Contact WHERE Contact.Id = :lead.ConvertedContactId];con.Birthdate = lead.Date_Of_Birth__c;
con.Email=lead.Email;
update con;}
}
}
Thanks in Advance
Madhulendra
For the test you need to create a lead, insert it, convert it (and create a new contact, oppty, and account), query the contact for the birthdate & email fields & do a system assert that they are as expected.
Details on how to convert a lead in code are in the apex guide & the API guide:
http://www.salesforce.com/us/developer/docs/apexcode/index.htm
http://www.salesforce.com/us/developer/docs/api/index.htm
This Java code from the API docs is the closest thing to Apex so you can probably just tweak this: