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 convert lead to account using REST API in salesforce?

    Tagged: Account, Lead Conversion, Rest API, Salesforce Development

    • Salesforce® Discussions

      How to convert lead to account using REST API in salesforce?

      Posted by Vikas Kumar on January 3, 2017 at 2:02 PM

      Hi All,

      How can we convert lead to account using Rest Api

      Thanks

      Shekhar Gadewar replied 9 years, 2 months ago 3 Members · 2 Replies
      • Account
      • Lead Conversion
      • Rest API
      • Salesforce Development
    • 2 Replies
    • Ajit

      Member
      January 4, 2017 at 5:43 AM

      Hi

      try this code below and let me know it worked or not :

      @RestResource(urlMapping='/Lead/*')
      global with sharing class RestLeadConvert {

      @HttpGet
      global static String doGet() {
      String ret = 'fail';
      RestRequest req = RestContext.request;
      RestResponse res = RestContext.response;
      String leadId = req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);
      Database.LeadConvert lc = new Database.LeadConvert();
      lc.setLeadId(leadId);

      LeadStatus convertStatus = [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true LIMIT 1];
      lc.setConvertedStatus(convertStatus.MasterLabel);
      Database.LeadConvertResult lcr ;
      try{
      lcr = Database.convertLead(lc);
      system.debug('*****lcr.isSuccess()'+lcr.isSuccess());
      ret = 'ok';
      }
      catch(exception ex){
      system.debug('***NOT CONVERTED**');
      }
      return ret;
      }
      }

    • Shekhar Gadewar

      Member
      January 5, 2017 at 5:11 AM

      Hi Ajit,

       

      Thanks for sharing snippet.

      Can u tell me how to test that?

      How we can check that code in execution?

       

      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

    salesforce integration

    The Most Common Types of Salesforce Integrations

    Blog in Salesforce integration

    The combination happens when separate individuals or things are united, similar to the coordination of understudies from the entirety of the area's primary schools at…

    Apex Web Services, Business Logic, Customer Application, Data Integration, Enterprise Web Services
    Marziya Apr 21, 2020
    11,514  Views
    Display Bar Chart

    Learn How to Display Bar Chart in Salesforce Lightning Web Component

    Blog in Lightning, Others

    Introduction The graphical representation of information and data is known as data visualization. Data visualisation tools make it easy to see and understand trends, outliers,…

    Bar Chart, ChartJS, ChartJS File, Charts, Child Component
    Anuj Apr 21, 2021
    21,881  Views

    Salesforce Developer Job Opportunities in 2024

    Blog in Others

    Salesforce Developers are in huge demand due to the rapid growth of Salesforce worldwide. Based on a research by IDC, the number of employment requisition…

    Salesforce Apex Developer, Salesforce App Development, Salesforce Application Developer, Salesforce Career Advice, Salesforce career growth
    Ray brad Sep 11, 2024
    526  Views

    Popular Salesforce Videos

    Salesforce AppExchange Pricing Models

    Salesforce AppExchange Pricing Models

    Video in AppExchange

    Salesforce AppExchange offers a wide range of solutions and applications designed to enhance and extend the functionality of Salesforce. However, understanding the pricing models can…

    Salesforce Developer, salesforce, Salesforce Apps, Salesforce Hulk, Salesforce Webinar
    Cyntexa Aug 22, 2023
    1,578  Views
    Learn About Types of Sandboxes in Salesforce

    Learn About Types of Sandboxes in Salesforce

    Video in Salesforce Training, Salesforce Admin

    A sandbox is a copy of your organization in a separate environment that you can use for a variety of purposes, such as testing and training.…

    Salesforce Training, Salesforce Tutorial, salesforce, Salesforce Video, Salesforce Learning
    CRS Oct 29, 2021
    2,722  Views
    Salesforce Chatter Training - Staff

    Salesforce Chatter Training - Staff

    Video in Salesforce Training

    In this video, Kylee Durant provides a Salesforce Chatter Training overview, detailing how to enable and configure chatter groups, as well as create customer groups.

    Salesforce Training, Salesforce Tutorial, Salesforce Chatter, salesforce, Salesforce Video
    Mayra Oct 10, 2022
    1,280  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.