You need to sign in to do that
Don't have an account?
Lead Convert Trigger to not create new account but use and existing account.
I am using a trigger to fire on my web to lead form from a specific leadsource to create a contact. Is there a way for it to not create an account but add the contact to and existing account? here is my code. what I am thinking is that I would create an account trigger to fire on the leadsource and add the contact to the account correct??
here is the lead trigger:
trigger KYR_LeadConvert on Lead (after insert,after update) {
List<String> LeadNames = new List<String>{};
for(Lead myLead: Trigger.new){
if((myLead.isconverted==false) && (myLead.LeadSource == 'youknowit')) {
Database.LeadConvert lc = new database.LeadConvert();
lc.setLeadId(myLead.id);
lc.setopportunityName(myLead.Refersite__c);
lc.convertedStatus = 'Qualified';
//Database.ConvertLead(lc,true);
Database.LeadConvertResult lcr = Database.convertLead(lc);
System.assert(lcr.isSuccess());
}
}
}
thank you for the help;)
try,
lc.setAccountId('001xxxxxx');
then you can convert your Lead to a Contact of an existing Account.
All Answers
try,
lc.setAccountId('001xxxxxx');
then you can convert your Lead to a Contact of an existing Account.
Jia,
Thank you are awesome .... works great !!!