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

    Stripe ACH Integration with Salesforce

    Blog in Salesforce integration

    During our previous conversation, we discussed how Stripe has changed the world of Online Payments in recent years. We also discussed that when we couple it…

    APIs, Benefits of ACH Payments, ChargeEasy, Common Challenges, Contact Information
    Kizzy Consulting Sep 19, 2023
    1,500  Views
    controller extension

    Controller Extensions in Salesforce | The Developer Guide

    Blog in Others

    Controller Extension is an Apex Code that extends the functionality of a Standard or Custom Controller. When to Use Controller Extensions When we want to…

    Apex Pages, Controller Extension, Controller Extensions, Custom Controller, Developer Guide
    Kirandeep Aug 20, 2020
    4,001  Views

    Can Salesforce Einstein AI Help in Sales Qualification?

    Blog in AI and ML, Sales, Salesforce Einstein

    Sales Qualification is an inevitable process and an important one for all sales teams. If you go to the market, you pick vegetables based on your…

    AppExchange, Artificial Intelligence, Attract Visitors to the Website, Authority, Automate Repetitive Tasks
    Cloudideas May 6, 2021
    3,527  Views

    Popular Salesforce Videos

    An Introduction to Salesforce org Nonprofit Cloud

    An Introduction to Salesforce org Nonprofit Cloud

    Video in Salesforce For Nonprofits

    Did you know that over 30,000 nonprofit organizations use Salesforce? Salesforce.org’s premier product, NPSP, helps nonprofits drive greater impact by connecting everything they do. Learn…

    Salesforce Developer, Salesforce Lightning Experience, Salesforce Implementation, Marketing Automation, Salesforce CRM
    Pooja Nov 21, 2018
    2,915  Views
    How To Use Salesforce Marketing Cloud Automation Studio

    How To Use Salesforce Marketing Cloud Automation Studio

    Video in Marketing, Salesforce Cloud Platform

    In this video, you will learn how to use Salesforce Marketing Cloud Automation Studio which will help in automating various processes. The following points will…

    Salesforce Training, Salesforce Tutorial, salesforce, Salesforce Marketing Cloud, Salesforce Video
    Algoworks Oct 8, 2021
    2,102  Views
    How To Use Javascript Editor In Formstack Part 2 - Learn Salesforce Series By Algoworks

    How To Use Javascript Editor In Formstack Part 2 - Learn Salesforce Series By Algoworks

    Video in Salesforce Integration, Salesforce Training

    Learn how to integrate Javascript editor in Formstack in this Salesforce tutorial brought to you by Algoworks. Did you miss the complete tutorial? To watch…

    Salesforce Training, Salesforce Integration, salesforce, salesforce services, Salesforce Video
    Algoworks Aug 28, 2020
    2,263  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.