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 › How to create a opportunity converted from lead in test class?

    Tagged: Account, Contact, Database, Lead, Lead Convert, Salesforce Opportunity, Test Class

    • Salesforce® Discussions

      How to create a opportunity converted from lead in test class?

      Posted by Ravi on April 30, 2016 at 6:01 PM

      How to create a opportunity converted from lead in test class?

      Surbhi replied 9 years, 8 months ago 2 Members · 1 Reply
      • Account
      • Contact
      • Database
      • Lead
      • Lead Convert
      • Salesforce Opportunity
      • Test Class
    • 1 Reply
    • Surbhi

      Member
      May 26, 2016 at 6:29 AM

      Hi Ravi,

      Please find below the code for creating lead and converting it to account, contact and opportunity in test class.

      Lead lead = new Lead();
      lead.FirstName='James';
      lead.LastName='Dane';
      lead.Company='Test Company';
      lead.LeadSource='GetTimely Online';
      insert lead;

      Database.LeadConvert lc = new database.LeadConvert();
      lc.setLeadId(lead.Id);

      Database.LeadConvertResult lcr = Database.convertLead(lc);

      Thanks

       

    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

    Object Level Security

    Object Level Security in Salesforce | The Salesforce Security Guide

    Blog in Salesforce Security

    We may provide access to an item in Salesforce at the profile or permissions set level. From the Profile or Permission set level, you may…

    API Form, Apps, Consent Units, Custom Profile, Customers
    Shivam Apr 21, 2022
    3,196  Views

    How ChatGPT Integration With Salesforce Can Accelerate Your Business Growth

    Blog in Salesforce

    ChatGPT is a new-age artificial intelligence (AI) chatbot that interacts with people in a human manner. It is a futuristic Generative Pre-trained Transformer (GPT) that…

    Artificial Intelligence, Automation, Chat GPT, chat gpt for salesforce, ChatBot
    Carol Jun 2, 2023
    2,504  Views

    Shrink Billing Cycles and Automate Invoices with DemandBlue’s Salesforce Billing Implementation

    Blog in Salesforce Implementation

    A simplified billing process elevates the buying experience, makes customers feel comfortable, and often turns them into repeat customers. At DemandBlue, our end-to-end Salesforce Billing…

    Automate Invoices, Automate Operations, Automate Sales, Billing Cycles, Billing Platform
    DemandBlue Jan 21, 2022
    2,086  Views

    Popular Salesforce Videos

    Deep Dive into Salesforce Connected App

    Deep Dive into Salesforce Connected App

    Video in Salesforce Training

    In this session, we will deep dive into Salesforce Connected app, its usage for Salesforce developers and admins, various options and configurations provided for Authentication…

    Salesforce Training, Salesforce Tutorial, Salesforce Administrator, Salesforce Admins, Salesforce Developers
    Pooja Sep 3, 2021
    1,995  Views
    Creation Of Validation Rules And Verifying Them In Salesforce

    Creation Of Validation Rules And Verifying Them In Salesforce

    Video in Salesforce Training

    Learn how to create and verify validation rules in Salesforce. This video will cover the following points - 1. Introduction Get a brief introduction about…

    Salesforce Training, Salesforce Tutorial, Salesforce Development, salesforce, Salesforce Development Tutorial
    Algoworks Dec 29, 2020
    8,256  Views
    Email-to-Case Advance | Clean Case Comments

    Email-to-Case Advance | Clean Case Comments

    Video in Salesforce Products

    Save your support reps from ‘Click fatigue’ while hastening the resolution of customer cases. Get Email to Case Advance, the much-needed power booster for your…

    salesforce, email to case, support, cleancomments, grazitti
    Shubham Jul 23, 2019
    1,807  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.