Toggle Side Panel

  • Blogs
  • 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
  • Contact Us
  • Discussions
More options
    Sign in Sign up
    • Blogs
    • 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
    • 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, 9 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;
      }
      }

    • [adinserter block='9']
    • 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

    Popular Salesforce Blogs

    salesforce myth

    Busting 5 Myths Around Salesforce

    Blog in Salesforce

    In today’s fast-paced world, there are a lot of businesses and start-ups who come up with a ground-breaking idea but unfortunately fail to make it…

    AppExchange, AppExchange Apps, Apps, Automotive, B2B Marketing Automation
    Algoworks Jul 7, 2022
    2,534  Views
    Enabling and Creating Accounts in Salesforce

    Enabling and Creating Personal Accounts And Business Accounts in Salesforce

    Blog in Others

    Salesforce accounts are used to store information about customer and entities with which you are working such as government agencies, schools, companies, or individuals. You…

    Salesforce Customization, Salesforce Fields, Salesforce Objects, Salesforce Records
    Tanu Sep 24, 2016
    24,961  Views
    CRM Software

    How Does a CRM Software Add Value to Business? | Salesforce Guide

    Blog in Salesforce

    Everything around you is data in a massive amount. When you look around yourself, you find data and information in the tiniest things, words, facts,…

    Application, Boost Revenue, Build Brand Equity, Business, Business Growth
    Melonleaf Sep 27, 2021
    4,973  Views

    Popular Salesforce Videos

    Integration: MuleSoft Composer for Salesforce

    Integration: MuleSoft Composer for Salesforce

    Video in Salesforce Integration

    What you can do with MuleSoft Composer for Salesforce Enrich your 360-degree customer view by empowering your Salesforce admins with a no-code solution for quickly…

    Salesforce Training, Salesforce Tutorial, Salesforce Integration, salesforce, Salesforce Admins
    Prafull Jan 29, 2021
    2,644  Views
    Difference between Workflow Rules and Process Builder in Salesforce

    Difference between Workflow Rules and Process Builder in Salesforce

    Video in Others

    This video explains the difference between workflow rules and process builder. It is divided into four parts : 1. When to use Workflow 2. When…

    Process Builder, Salesforce Video Tutorials, Salesforce workflow rules
    Nauman Jul 11, 2018
    6,158  Views
    Salesforce Career Personality Quiz

    Salesforce Career Personality Quiz

    Video in Salesforce Stories

    Which Salesforce career path is right for you? Take this 23 question quiz to learn which Salesforce career is the best match for your personality…

    Salesforce Training, Salesforce Tutorial, Salesforce Jobs, Salesforce Certification, Salesforce Developer
    Nauman Apr 27, 2021
    2,614  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®.

    We use cookies to enhance your browsing experience. Please see our privacy policy if you'd like more information on our use of cookies.