-
Salesforce Trigger to convert leads into accounts and contacts and add task to it
Salesforce Trigger to convert leads into accounts and contacts and add task to it
trigger LeadConvert on Lead (after insert,after update) {
//Bulkified
for (Lead lead : Trigger.new) {
if (lead.isConverted == false) //to prevent recursion{
Database.LeadConvert lc = new Database.LeadConvert();
lc.setLeadId(lead.Id);String oppName = lead.Name;
lc.setOpportunityName(oppName);LeadStatus convertStatus = [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true LIMIT 1];
lc.setConvertedStatus(convertStatus.MasterLabel);Database.LeadConvertResult lcr = Database.convertLead(lc);
//System.assert(lcr.isSuccess());}
}
}
Log In to reply.
Popular Salesforce Blogs
Integration Through JWT FLOW | Server-to-Server Integration | Salesforce
JWT Integration This is used for Server-to-Server Integration Scenarios. This Flow Uses a certificate to sign the JWT request and doesn’t require explicit user interaction.…
Insert Record using JavaScript Remoting with Visualforce Page
Hey there! We must have heard about javascript remoting. So today we are going to learn about how to use the Javascript remoting to build…
Popular Salesforce Videos
Salesforce CRM Services offered by Melonleaf Consulting
Melonleaf Consulting offers customized and configured Salesforce CRM Solutions and Services that can revolutionize your business. Experience the power of top-notch and highly effective Salesforce…
Salesforce Integration Tutorial | Integrate Salesforce with Apps
This "?????????? ??????????? ????????" video by Edureka will help you understand what is Salesforce integration in detail. It will also address the various Salesforce integration…
Algoworks All Set To Attend French Touch Dreamin’ 2019!
French Touch Dreamin’ 2019 is right around the corner and Team Algoworks is going to attend this European Salesforce community-led event which is going to…