Toggle Side Panel

  • Home
  • Articles
    • All Articles
    • Blogs
    • Videos
    • Infographics
  • Consultants
    • Salesforce Product Expertise
      • Top Salesforce ConsultantsTop Salesforce Consultants
      • Marketing Cloud ConsultantsMarketing Cloud Consultants
      • Service Cloud ConsultantsService Cloud Consultants
      • Experience Cloud ConsultantsExperience Cloud Consultants
      • Analytics Cloud ConsultantsAnalytics Cloud Consultants
    • Salesforce Industry Expertise
      • Non-Profit Cloud ConsultantsNon-Profit Cloud Consultants
      • Financial Service Cloud ConsultantsFinancial Service Cloud Consultants
      • Health Cloud ConsultantsHealth Cloud Consultants
      • Commerce Cloud ConsultantsCommerce Cloud Consultants
      • Manufacturing Cloud ConsultantsManufacturing Cloud Consultants
    • Salesforce Experts by Location
      • USATop Salesforce Consultants in USA
      • IndiaTop Salesforce Consultants in India
      • AustraliaTop Salesforce Consultants in Australia
      • United KingdomTop Salesforce Consultants in UK
      • CanadaTop Salesforce Consultants in Canada
  • Webinars
  • Marketplace
  • Advertise With Us
  • Contact Us
  • Discussions
More options
    Sign in Sign up
    • Home
    • Articles
      • All Articles
      • Blogs
      • Videos
      • Infographics
    • Consultants
      • Salesforce Product Expertise
        • Top Salesforce ConsultantsTop Salesforce Consultants
        • Marketing Cloud ConsultantsMarketing Cloud Consultants
        • Service Cloud ConsultantsService Cloud Consultants
        • Experience Cloud ConsultantsExperience Cloud Consultants
        • Analytics Cloud ConsultantsAnalytics Cloud Consultants
      • Salesforce Industry Expertise
        • Non-Profit Cloud ConsultantsNon-Profit Cloud Consultants
        • Financial Service Cloud ConsultantsFinancial Service Cloud Consultants
        • Health Cloud ConsultantsHealth Cloud Consultants
        • Commerce Cloud ConsultantsCommerce Cloud Consultants
        • Manufacturing Cloud ConsultantsManufacturing Cloud Consultants
      • Salesforce Experts by Location
        • USATop Salesforce Consultants in USA
        • IndiaTop Salesforce Consultants in India
        • AustraliaTop Salesforce Consultants in Australia
        • United KingdomTop Salesforce Consultants in UK
        • CanadaTop Salesforce Consultants in Canada
    • Webinars
    • Marketplace
    • Advertise With Us
    • Contact Us
    • Discussions
    Close search

    Activity › Forums › Salesforce® Discussions › Salesforce Trigger to convert leads into accounts and contacts and add task to it

    Tagged: Account Detail, After Insert, After Update, Contact List in Salesforce, Contact Record, Database Query, Lead Records, Salesforce Database, Salesforce Records, Salesforce Trigger, Salesforce Trigger Condition, Task

    • Salesforce® Discussions

      Salesforce Trigger to convert leads into accounts and contacts and add task to it

      Posted by ANISH KUMAR on January 13, 2018 at 1:30 PM

      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());

      }
      }
      }

       

      Shubham replied 8 years ago 2 Members · 1 Reply
      • Account Detail
      • After Insert
      • After Update
      • Contact List in Salesforce
      • Contact Record
      • Database Query
      • Lead Records
      • Salesforce Database
      • Salesforce Records
      • Salesforce Trigger
      • Salesforce Trigger Condition
      • Task
    • 1 Reply
    • Shubham

      Member
      January 16, 2018 at 2:29 PM

      Can you please elaborate more what is your query ?

    Log In to reply.

    • Public
    • All Members
    • My Connections
    • Only Me
    • Public
    • All Members
    • My Connections
    • Only Me
    • Public
    • All Members
    • My Connections
    • Only Me

    application solution

    Popular Salesforce Blogs

    JWT Integration

    Integration Through JWT FLOW | Server-to-Server Integration | Salesforce

    Blog in Salesforce integration

    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.…

    Certificate and Private Keys, Certificate Signing Request, Client App, data, Debug Log
    Mohit Kumar Dec 12, 2022
    2,369  Views
    Insert Record using JavaScript Remoting with Visualforce Page

    Insert Record using JavaScript Remoting with Visualforce Page

    Blog in Others, Visualforce

    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…

    Custom Table, DML Operation, Insert Record, Javascript in Salesforce, JavaScript Remoting
    Parul Sep 28, 2018
    5,525  Views
    Approval Process

    Approval Process in Salesforce - Developer Guide

    Blog in Others, Salesforce

    The endorsement cycle in Salesforce is a mechanized cycle that supports records for Salesforce. As the cycle is a car it chips away at specific…

    Approval Cycle, Approval Process, Approval Process in Salesforce, Approval Rules, Approver Manager
    Aditya Oct 22, 2020
    6,249  Views

    Popular Salesforce Videos

    Salesforce CRM Services offered by Melonleaf Consulting

    Salesforce CRM Services offered by Melonleaf Consulting

    Video in Salesforce Consultant

    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 Training, Salesforce Tutorial, salesforce, Salesforce Consulting, Salesforce CRM
    Melonleaf Jul 13, 2023
    1,078  Views
    Salesforce Integration Tutorial | Integrate Salesforce with Apps

    Salesforce Integration Tutorial | Integrate Salesforce with Apps

    Video in Salesforce Integration

    This "?????????? ??????????? ????????" video by Edureka will help you understand what is Salesforce integration in detail. It will also address the various Salesforce integration…

    Salesforce Training, Salesforce Tutorial, Salesforce Integration, salesforce, Salesforce Integration Tutorial
    Pooja Feb 14, 2022
    4,286  Views
    Algoworks All Set To Attend French Touch Dreamin’ 2019!

    Algoworks All Set To Attend French Touch Dreamin’ 2019!

    Video in Events

    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…

    Salesforce Partner, salesforce services, Salesforce Event, Salesforce Consulting, Salesforce Video
    Algoworks Sep 13, 2019
    1,801  Views
    Footer Forcetalks logo

    support@forcetalks.com

    • twitterx

    Quick Links

    Advertise with Us

    Salesforce® Articles

    Dreamforce 2023

    Top Salesforce® Bloggers 2023

    Top Salesforce Consultants

    Get Listed

    Company

    Contact Us

    About Us

    Privacy Policy

    Terms & Conditions

    InsightHub

    Salesforce Blogs

    Salesforce Videos

    Salesforce Groups

    Salesforce Jobs

    © 2026 - Forcetalks ● All Rights Reserved

    Salesforce® is a trademark of Salesforce® Inc. No claim is made to the exclusive right to use “Salesforce”. Any services offered within the Forcetalks website/app are not sponsored or endorsed by Salesforce®.

    Try AuditMyCRM - It is a Salesforce CRM Audit tool which comprehensively scans your Salesforce org and gives you the list of errors or warnings you need to take care of.
    We use cookies to enhance your browsing experience. Please see our privacy policy if you'd like more information on our use of cookies.