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, 10 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

    B2B Commerce Data Model

    Get to Know About the B2B Commerce Data Model | Salesforce Help Guide

    Blog in Others, Salesforce

    What Exactly Is B2B Commerce Anyway? Business-to-business (B2B) trade is a world far eliminated from the online business encounters most people are utilized to. B2B…

    B2B, B2B Business, B2B Commerce, B2B Commerce Data Model, B2B Commerce Information Model
    MOHIT Mar 22, 2021
    10,842  Views

    All You Need to Know About DupeCatcher Salesforce

    Blog in Others

    Duplicate records can be a headache for any Salesforce admin or user. Not only do they clutter up the database and make it difficult to…

    Best Practices, Bulk Import, Clean, Compliance, Configuration
    Rahul Jun 2, 2023
    1,936  Views
    salesforce certifications

    The Perks of Getting a Salesforce Certification

    Blog in Salesforce Certifications

    Certifications are the way to go these days if one is looking to upskill and grow their career. Degrees are great, but a course certification…

    career, Certification in Salesforce, Certifications, Certified Employer, Course Certification
    Swathi Aug 29, 2022
    3,631  Views

    Popular Salesforce Videos

    Creating a Salesforce Lightning App in 12 Minutes

    Creating a Salesforce Lightning App in 12 Minutes

    Video in Lightning

    Salesforce is the easiest and quickest way to make quality enterprise apps using clicks instead of code.This video attempts to demonstrate just how quick and…

    Salesforce Tutorial, Salesforce Developer, Salesforce Lightning Experience, Lightning App Builder, Salesforce Lightning Development for Beginners
    Jogender Nov 21, 2018
    3,182  Views
    Building a Custom UI with Lightning Web Components | Salesforce Tutorial

    Building a Custom UI with Lightning Web Components | Salesforce Tutorial

    Video in Lightning, Salesforce Training

    Lightning Web Components is a modern JavaScript framework that leverages the web standards breakthroughs over the past few years. Watch this session to understand how…

    Salesforce Training, Salesforce Tutorial, salesforce platform, UI, Salesforce Video
    Rupal Kakkar Apr 29, 2021
    2,539  Views
    Agile in Salesforce | Agile Salesforce Implementation

    Agile in Salesforce | Agile Salesforce Implementation

    Video in Salesforce Implementation

    Watch this video to learn about Agile Salesforce Implementation When Salesforce met Agile Agile vs Waterfall Introduction to Scrum Scrum Roles Scrum Ceremonies Q&A

    Salesforce Training, Salesforce Tutorial, Salesforce Implementation, Salesforce Video, Salesforce Learning
    Jogender Jun 29, 2021
    2,814  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.