You need to sign in to do that
Don't have an account?
Natasha Ali
How do I get my 'autoconvert' trigger to not create new opportunities when it auto converts a lead into a person account?
Hi,
So this trigger autoconverts a lead into a person account when they come in without the company field populated, and becuase it gets conceted into aperson account, it creates a contact & account & opportunity. We don't want it to create an opportunity, so how would I go about doing this with my trigger? or would I have to create a new one?
Any help is much appreciated!!!
Many Thanks :)
Natasha
So this trigger autoconverts a lead into a person account when they come in without the company field populated, and becuase it gets conceted into aperson account, it creates a contact & account & opportunity. We don't want it to create an opportunity, so how would I go about doing this with my trigger? or would I have to create a new one?
Trigger AutoConvert on Lead (after insert) { LeadStatus convertStatus = [ select MasterLabel from LeadStatus where IsConverted = true limit 1 ]; List<Database.LeadConvert> leadConverts = new List<Database.LeadConvert>(); for (Lead lead: Trigger.new) { if (!lead.isConverted && lead.Company == null) { Database.LeadConvert lc = new Database.LeadConvert(); String oppName = lead.Name; lc.setLeadId(lead.Id); lc.setOpportunityName(oppName); lc.setConvertedStatus(convertStatus.MasterLabel); leadConverts.add(lc); } } if (!leadConverts.isEmpty()) { List<Database.LeadConvertResult> lcr = Database.convertLead(leadConverts); } }
Any help is much appreciated!!!
Many Thanks :)
Natasha
Replace: With: