
3 réponses

Trigger AutoConverter on Lead (after insert,after update) { 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 ==false){ if(lead.Status == 'Convert') { Database.LeadConvert lc = new Database.LeadConvert(); String oppName = lead.LastName; lc.setLeadId(lead.Id); lc.setOpportunityName(oppName); lc.setConvertedStatus(convertStatus.MasterLabel); leadConverts.add(lc); } } } if (!leadConverts.isEmpty()) { List<Database.LeadConvertResult> lcr = Database.convertLead(leadConverts); } }Lead Owner Shoud be queue here and when login in other profile except system admin its asking required filed missing you must specify the ownerId of the user how to set owner of the id if lead owner is queue