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

    Steps to Prompt Users to Login with Federated SSO in Salesforce

    Blog in Others

    We have seen how to login to Salesforce using Federated authentication in my last blog - Federated Authentication Using SAML to Log in to Salesforce…

    Authentication Configuration, Domain Management, Domain Name Registration, Salesforce Implementation, Salesforce Login
    Naman Apr 28, 2016
    29,303  Views
    Person Accounts In Salesforce

    About Person Account In Salesforce

    Blog in Others

    Introduction Person accounts allow you to store information that applies to humans, not companies or organizations, such as first and last names. Although a standard…

    B2B Industry, B2C Industry, Business Accounts, Business Model, Business to Consumer
    Anuj Sep 10, 2020
    18,131  Views

    CRM's Advantages in Healthcare

    Blog in Salesforce

    The demand for customer relationship management (CRM) software solutions is increasing across all types of businesses. Businesses of all sizes, small and large, as well…

    Appointments, Automation, B2P Relationships, Business Processes, Businesses
    Ritika Aug 28, 2023
    1,048  Views

    Popular Salesforce Videos

    Salesforce Careers - Why Consider A Career In Salesforce

    Salesforce Careers - Why Consider A Career In Salesforce

    Video in Salesforce Stories

    This Salesforce Training Video will help you understand about Salesforce, Salesforce market situation, Salesforce job trends, Salesforce career options and how Salesforce is a safe…

    Salesforce Careers, Certified Salesforce Admin, Salesforce CRM, Salesforce Tutorials, Salesforce Admins
    Simplilearn Apr 24, 2019
    1,988  Views
    Salesforce Lightning Tutorial | Build a Custom Lightning Home Page

    Salesforce Lightning Tutorial | Build a Custom Lightning Home Page

    Video in Lightning

    This Salesforce Lightning Tutorial video by Edureka will help you understand what exactly is Salesforce lightning. It will also talk about some of the features…

    Salesforce Training, Salesforce Tutorial, Salesforce Lightning, salesforce, Salesforce Lightning Tutorial
    Jogender Sep 6, 2021
    1,972  Views
    Why Salesforce is in Demand? What is Salesforce? Salesforce Developer Jobs And Salary in 2022

    Why Salesforce is in Demand? What is Salesforce? Salesforce Developer Jobs And Salary in 2022

    Video in Salesforce Development

    In this video, Career Tips With Poonam discusses Salesforce job opportunities, what Salesforce is, Salesforce Developer Jobs and Salary in 2022 and much more.

    Salesforce Training, Salesforce Tutorial, Salesforce Jobs, Salesforce Developer, What Is Salesforce
    Mayra Dec 21, 2022
    1,629  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.