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, 2 months 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

    Why Soft Skills Matter More Than Technical Skills When Hiring a Salesforce Developer

    Blog in Salesforce Admin

    Introduction When hiring a Salesforce Developer, most companies focus on technical expertise—proficiency in Apex, Lightning Web Components, and integrations. While technical skills are crucial, they…

    Salesforce Admin, Salesforce Consultant, salesforcedeveloper
    Iqra Aug 1, 2025
    175  Views
    Benefits of salesforce native application for growth of business

    Benefits of Salesforce Native Applications for The Growth of Businesses

    Blog in Salesforce

    Salesforce has emerged as a key player, providing a versatile platform for organizations to manage their customer relationships, streamline processes, and drive growth. One of the…

    Audit Trail, Business Growth, Certifications, Compliance, Cost Efficiency
    DianApps Feb 23, 2024
    1,035  Views

    3 Hot Trends Secretly Pointing towards Future of CRM

    Blog in Others

    Customer Relationship Management or CRM is the future of the business and is not going to fed so soon. Starting from small businesses to the…

    CRM, CRM Implementation, CRM Softwares, CRM System, CRM Technology
    Dream Cyber Jun 19, 2019
    2,322  Views

    Popular Salesforce Videos

    Salesforce Service Cloud Overview Demo

    Salesforce Service Cloud Overview Demo

    Video in Salesforce Stories

    Service Cloud is a complete service solution built on the Salesforce platform that lets you quickly adapt to change, to deliver trusted service from anywhere.…

    Salesforce Service Cloud, salesforce, salesforce platform, Salesforce Video, Service Cloud
    Nauman May 21, 2020
    1,929  Views
    Salesforce Multi-factor Authentication/Two-factor Authentication End User Training Video

    Salesforce Multi-factor Authentication/Two-factor Authentication End User Training Video

    Video in Salesforce Security

    Watch this video to learn all about Salesforce Multi-factor Authentication/Two-factor Authentication. This is a training video. Watch and learn.

    Salesforce Training, Salesforce Tutorial, Salesforce Security, Salesforce Video, Salesforce Learning
    Prafull Dec 28, 2021
    2,550  Views
    Record Triggered Flows with Real Time Scenarios | Salesforce Tutorial

    Record Triggered Flows with Real Time Scenarios | Salesforce Tutorial

    Video in

    In this video, you will understand 1. What is Record triggered flow? 2. How and when to use Record triggered flows? 3. Real-time scenarios 4.…

    Salesforce Training, Salesforce Tutorial, Process Builder, Salesforce Video, Salesforce Learning
    Pooja Nov 11, 2021
    2,560  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.