• Home
  • Articles
    • All Articles
    • Blogs
    • Videos
    • Infographics
  • Consultants
    • Salesforce Product Expertise
      • Top Salesforce Consultants
      • Marketing Cloud Consultants
      • Service Cloud Consultants
      • Experience Cloud Consultants
      • Analytics Cloud Consultants
    • Salesforce Industry Expertise
      • Non-Profit Cloud Consultants
      • Financial Service Cloud Consultants
      • Health Cloud Consultants
      • Commerce Cloud Consultants
      • Manufacturing Cloud Consultants
  • Jobs
  • Marketplace
  • Stories
  • Top Bloggers 2022
  • Advertise With Us
  • Quizzes
  • Discussions
  • Groups
    Sign in Sign up
    • Home
    • Articles
      • All Articles
      • Blogs
      • Videos
      • Infographics
    • Consultants
      • Salesforce Product Expertise
        • Top Salesforce Consultants
        • Marketing Cloud Consultants
        • Service Cloud Consultants
        • Experience Cloud Consultants
        • Analytics Cloud Consultants
      • Salesforce Industry Expertise
        • Non-Profit Cloud Consultants
        • Financial Service Cloud Consultants
        • Health Cloud Consultants
        • Commerce Cloud Consultants
        • Manufacturing Cloud Consultants
    • Jobs
    • Marketplace
    • Stories
    • Top Bloggers 2022
    • Advertise With Us
    • Quizzes
    • Discussions
    • Groups

    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 5 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

    Reply

    Subscribe

    airslate

    SALESFORCE PRODUCT EXPERTISE

    • Top Salesforce Consultants
    • Top Salesforce Experience Cloud Consultants
    • Top Salesforce Analytics Cloud Consultants
    • Top Salesforce Service Cloud Consultants
    • Top Salesforce Marketing Cloud Consultants

    SALESFORCE INDUSTRY EXPERTISE

    • Top Salesforce Consultants
    • Top Salesforce Manufacturing Cloud Consultants
    • Top Salesforce Non-Profit Cloud Consultants
    • Top Salesforce Health Cloud Consultants
    • Top Salesforce Financial Service Cloud Consultants
    • Top Salesforce Commerce Cloud Consultants

    Popular Salesforce Blogs

    Tips to Choose Reliable Salesforce Consulting Partners in 2019

    Blog in Salesforce Consultant

    Salesforce now helps enterprises to streamline various facets of a business ranging from sales to product delivery and customer support. Salesforce is so popular for…

    Customer Engagement, Salesforce Consultants, Salesforce Consulting Companies, Salesforce Customization, Salesforce Implementation
    Sujain Sep 18, 2019
    1,614  Views

    Common Salesforce Flow Errors and How to Solve Them

    Blog in Salesforce

    Salesforce Flow errors happen all the time. However, you can still manage a clean user experience even when these errors occur. When you give users…

    Avoiding Flow Errors, Campaign, Complex Flows, Custom Automated Logic, Custom Screens
    Apphienz Aug 26, 2021
    1,972  Views
    Domain Security

    What is Enhanced Domain Security in Salesforce in 2023?

    Blog in Salesforce Security

    What is Enhanced Domain? Enhanced domains are the latest version of My Domain that meets the latest browser requirements. With enhanced domains, all URLs across your…

    browser-security, content files, cookies, Database.com, Domain Security
    Aman Dec 12, 2022
    1,303  Views

    Popular Salesforce Videos

    Features of Salesforce Industries (Vlocity)

    Features of Salesforce Industries (Vlocity)

    Video in Salesforce Training

    There are many features of Salesforce Industries that make it a one-stop solution for businesses. Salesforce Industries or Vlocity offers Omnichannel processes with lightning Web,…

    Salesforce Training, Salesforce Tutorial, salesforce, Salesforce Webinar, data migration
    Cyntexa Sep 16, 2022
    466  Views
    How Much Time to Give to Salesforce Preparation?

    How Much Time to Give to Salesforce Preparation?

    Video in Salesforce Training, Salesforce Admin

    Wondering how much time to give for Salesforce preparation? Watch this video it explains distinctly how much time you need to learn. If you have…

    Salesforce Training, Salesforce Tutorial, Salesforce Online Training, Salesforce Jobs, Salesforce Developer
    CRS Info Solutions Jun 13, 2022
    756  Views
    Spring '21 Release - Time-dependent Action in Salesforce Flows

    Spring '21 Release - Time-dependent Action in Salesforce Flows

    Video in Others, Salesforce Training

    If you’re familiar with scheduled actions in Process Builder or time-dependent actions in workflow rules, know that scheduled paths on record-triggered flows can accomplish the…

    Salesforce Training, Salesforce Tutorial, Process Builder, Salesforce Video, Salesforce Learning
    Shubham Jan 19, 2021
    4,964  Views
    Footer Forcetalks logo

    [email protected]

    Forcetalks Android App
    Forcetalks IOS App

    Quick Links

    Advertise with Us

    Salesforce® Articles

    Dreamforce 2022

    Top Salesforce® Bloggers 2021

    Tips to choose Best Salesforce® Consulting Company

    Get Listed

    Company

    Contact Us

    About Us

    Privacy Policy

    Terms & Conditions

    Submissions

    Write a Blog

    Start a New Discussion

    Post a Video

    Post an Infographic

    © 2023 - 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®.

    Forum Description

    Report

    There was a problem reporting this post.

    Harassment or bullying behavior
    Harassment or bullying behavior
    Contains mature or sensitive content
    Contains misleading or false information
    Mobile App Reported Contents
    Contains abusive or derogatory content
    Contains spam, fake content or potential malware

    Block Member?

    Please confirm you want to block this member.

    You will no longer be able to:

    • See blocked member's posts
    • Mention this member in posts
    • Invite this member to groups
    • Message this member
    • Add this member as a connection

    Please note: This action will also remove this member from your connections and send a report to the site admin. Please allow a few minutes for this process to complete.

    Report

    You have already reported this .
    Clear Clear All
    We use cookies to enhance your browsing experience. Please see our privacy policy if you'd like more information on our use of cookies.