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 8 years, 11 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

    Successful Salesforce User Adoption in 2024: Strategies and Red Flags

    Blog in Salesforce Implementation

    Early in the Salesforce adoption stages, 90% of companies are promised streamlined workflows, comprehensive insights, and seamless operations regardless of location.  However, CRM systems implemented…

    Business Performance Metrics, Buy-In, C-level, Causes of Low Salesforce CRM Adoption, Complexity Concerns
    Twistellar Jan 3, 2024
    3,031  Views

    2023 CRM Landscape: A Deep Dive into Salesforce vs Microsoft Dynamics

    Blog in Salesforce Cloud Platform

    Business rivalry with healthy competition is quite common among all industries. It eliminates monopoly and gives more options to choose for users. When it comes…

    Automation, Benefits, Best-in-Class, Budget Allocation, Business Rivalry
    Algoworks Jun 8, 2023
    2,210  Views

    Salesforce Nonprofit Cloud Winter '26 Highlights

    Blog in Salesforce Releases

    Just like your favorite winter sweater, the latest Nonprofit Cloud updates are here to keep your organization warm, cozy, and running smoothly! The Winter '26…

    Agentforce, Application Management, Case Management, Cloud Computing, CRM Content
    DB Oct 14, 2025
    86  Views

    Popular Salesforce Videos

    How To Set Up DKIM Key In Salesforce?

    How To Set Up DKIM Key In Salesforce?

    Video in Salesforce Admin

    If you use Salesforce for sending emails, we highly recommend setting up DKIM authentication to sign your outgoing messages and improve their deliverability and trustworthiness.…

    Salesforce Admin, Salesforce VIdeos, Videos, DKIM, Salesforce DKIM
    ENWAY Jan 22, 2024
    1,134  Views
    My Wild Career Journey: From Lawyer to Salesforce Consultant

    My Wild Career Journey: From Lawyer to Salesforce Consultant

    Video in Salesforce Stories

    People often ask Brainiate what his career journey looked like, and in this video he share with you the key milestones that brought him to…

    Salesforce Training, Salesforce Jobs, Salesforce Consultant, Salesforce Ecosystem, Salesforce Video
    Rupal Kakkar Aug 26, 2021
    2,487  Views
    eShopSync for QuickBooks - A Salesforce QuickBooks Connector

    eShopSync for QuickBooks - A Salesforce QuickBooks Connector

    Video in Salesforce Integration

    One of the best Quickbooks Integration Solution With Salesforce. It efficiently sends QuickBooks data (Categories, Users, Products, and Orders) to Salesforce. For more information, please…

    Salesforce Integration, salesforce, Salesforce Video, Salesforce Learning, quickbooks
    Deepika Jun 23, 2020
    1,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

    © 2025 - 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.