You need to sign in to do that
Don't have an account?
Natasha Ali 3
TRIGGER HELP - Add block functionality to existing trigger
Hi,
I have a trigger that converts a lead into a person account if the compnany name is null (when an application comes into SF). I need to add the functionality to block an application from coming into Salesforce if the email address already exists in Salesforce. Below is the trigger:
Many Thanks,
Natasha
I have a trigger that converts a lead into a person account if the compnany name is null (when an application comes into SF). I need to add the functionality to block an application from coming into Salesforce if the email address already exists in Salesforce. Below is the trigger:
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.setDoNotCreateOpportunity(true); 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