Toggle Side Panel

  • Blogs
  • 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
  • Contact Us
  • Discussions
More options
    Sign in Sign up
    • Blogs
    • 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
    • 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, 8 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

    Popular Salesforce Blogs

    Salesforce Trends

    Don't Miss to Check Out The Top Salesforce Trends In 2022

    Blog in Salesforce

    Salesforce is taking its strength in cloud computing to a new level. It gained market share by making an easy to use and affordable software…

    app development, App Requirements, Applications, Automation Technology, Blockchain
    Melonleaf Apr 22, 2022
    3,467  Views

    Tips to Find the Right Salesforce Managed Services Provider for Small Business

    Blog in Salesforce

    Choosing the right Salesforce Managed Services provider can be tough for small businesses. You need a partner who understands your needs, fits your budget, and helps you grow.…

    Managed Services, salesforce managed services, Salesforce Managed Services Provider
    TechForce Aug 1, 2025
    402  Views

    Can AI-powered chatbots for Healthcare be HIPAA-compliant? Salesforce Einstein is the Answer!

    Blog in Salesforce Einstein

    If AI is well-trained, humans might communicate with it and don't even know they interact not with another human. It's considered to be the most…

    Artificial Intelligence, Boost Customer Experience, ChatBot, Chatbot Automation, Clinical Records
    Sparkybit Feb 7, 2023
    2,349  Views

    Popular Salesforce Videos

    Automated Lead Conversion: Triggering Success When a Lead is Born!

    Automated Lead Conversion: Triggering Success When a Lead is Born!

    Video in Salesforce Automation

    Benefits of Trigger-Based Conversion Instantaneous Response to New Leads Improved Lead Nurturing and Engagement Streamlined Sales Process for Maximum Efficiency Data-Driven Insights for Continuous Improvement…

    Salesforce Tutorial, salesforce, Apex, Learn Salesforce, Salesforce Trigger
    SF Jun 21, 2024
    846  Views
    Lightning Flow – Release Readiness LIVE, Summer '20 | Salesforce

    Lightning Flow – Release Readiness LIVE, Summer '20 | Salesforce

    Video in Lightning

    Watch this amazing video & join the Product Managers to see how you can build flows and processes more efficiently with enhancements to Flow Builder,…

    Salesforce Lightning, salesforce, Process Builder, Salesforce Flow, Salesforce Video
    Jogender Aug 4, 2020
    1,468  Views
    Modern App Development On Salesforce - Apex Testing

    Modern App Development On Salesforce - Apex Testing

    Video in Salesforce Apex, Salesforce Training

    In this series, you will explore Modern App Development on the Salesforce platform, including Heroku. The live hands-on sessions will take you through the journey…

    Salesforce Training, Salesforce Apex, salesforce, salesforce platform, Salesforce Video
    Rupal Kakkar Jan 28, 2021
    5,573  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®.

    We use cookies to enhance your browsing experience. Please see our privacy policy if you'd like more information on our use of cookies.