You need to sign in to do that
Don't have an account?
newbie@new
Converting Lead through Apex code
Hi All
I am facing a issue while converting a lead through Trigger
my Requirement is lead should be automatically Converted whenever lead status is Qualified
Below is the error i am getting :
Code that i am using is
where am i doing the mistake ...
I am facing a issue while converting a lead through Trigger
my Requirement is lead should be automatically Converted whenever lead status is Qualified
Below is the error i am getting :
Code that i am using is
trigger web2LeadConvert on Lead (After Update ) { Database.LeadConvert[] converts = new Database.LeadConvert[0]; for(Lead record: Trigger.new) { if(record.Status == 'Qualified') { Database.LeadConvert thisLead = new Database.LeadConvert(); thisLead.setLeadId(record.Id); thisLead.setConvertedStatus('Qualified'); converts.add(thisLead); System.debug('@@@ It has @@'+converts); } } System.debug ('@@Convertssss'+ converts.isEmpty()); if(!converts.isEmpty()) { Database.convertLead(converts); System.debug('@@@converts'+converts); } }Please help me ...
where am i doing the mistake ...
Sorry for this issue you are encountering.
May I Suggest you please check with below link from stack exchange community with a similar discussion which might help you further.
- https://salesforce.stackexchange.com/questions/44756/how-to-convert-a-lead-to-contact-automatically
Please let us know if this helps.Kindly mark this as solved if the information was helpful.
Thanks,
Nagendra
Please check once below code :
Hope it helps you.
Please let me know in case of any other help.
thanks
Varaprasad