You need to sign in to do that
Don't have an account?
Jeffrey Uy
How to get LastName from Contact
Hello,
I am not a developer but would like to learn a few basic things.
One of which I am working on is to auto-create a lead from a case based on certain criteria. The code below works but I need to get the lastname from Contact instead of an ID. Can anyone show me how? Thanks.
trigger AutoCreateLead on Case (before insert)
{
case c=trigger.new[0];
if(c.Approved_for_Lead__c == TRUE)
{
list<lead>
l = [select id, Email from Lead where Email = :c.ContactEmail];
if(l.size()==0)
{
lead l1=new lead(lastname=c.ContactId , Email=c.ContactEmail, Company=c.SuppliedName, LeadSource='Converted From Case', Status = 'Open - Not Contacted', Title='Converted From Case', Phone=c.ContactPhone);
insert l1;
}
}
}
I am not a developer but would like to learn a few basic things.
One of which I am working on is to auto-create a lead from a case based on certain criteria. The code below works but I need to get the lastname from Contact instead of an ID. Can anyone show me how? Thanks.
trigger AutoCreateLead on Case (before insert)
{
case c=trigger.new[0];
if(c.Approved_for_Lead__c == TRUE)
{
list<lead>
l = [select id, Email from Lead where Email = :c.ContactEmail];
if(l.size()==0)
{
lead l1=new lead(lastname=c.ContactId , Email=c.ContactEmail, Company=c.SuppliedName, LeadSource='Converted From Case', Status = 'Open - Not Contacted', Title='Converted From Case', Phone=c.ContactPhone);
insert l1;
}
}
}
All Answers