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

    Leveraging Salesforce Technology to Improve Location-Based Funding Efficiency

    Blog in Salesforce

    It's no coincidence that community financing models centered on specific locations have become more prevalent in the past decade. Rising public service demands, increasing complexity…

    Cloud Technology, Cloud-based Communication Platform, Community Financing Models, Community-based Financing, Comprehensive Data
    Apphienz May 4, 2022
    1,858  Views
    Salesforce Spring 2022

    Salesforce Spring 2022 Updates - Features to Know About

    Blog in Salesforce Releases

    Take a Look at the Following Beta and Pilot Features: Use Knowledge Search Filters to Work More Efficiently (Pilot): – When a user uses the…

    Auto-Layout, Automation, Business Problems, Case, Change Management
    Arpit Singhal Jun 10, 2022
    2,730  Views

    Working with Files in Salesforce

    Blog in Others

    Most data in Salesforce is stored as records in the Salesforce database for your organization (technically, Salesforce uses a multi-tenant architecture that uses a combined…

    Data Access, File Sharing, Files, Salesforce Cloud, Salesforce Data
    PowerUser Apr 17, 2019
    28,503  Views

    Popular Salesforce Videos

    Salesforce Apex Tutorial for beginners | Apex Salesforce Tutorial

    Salesforce Apex Tutorial for beginners | Apex Salesforce Tutorial

    Video in Salesforce Apex

    Apex is a proprietary language developed by Salesforce.com. It is a strongly typed, object-oriented programming language that allows developers to execute flow and transaction control statements on the…

    Salesforce Training, Salesforce Tutorial, Salesforce Apex, salesforce, Apex
    Prafull Jun 6, 2022
    2,697  Views
    Salesforce Freelance Consulting - Course Preview

    Salesforce Freelance Consulting - Course Preview

    Video in Salesforce Consultant, Salesforce Training

    The Salesforce Freelance Consultant Course is finally live! Please comment and let me know what questions you have about whether this is a good fit…

    Salesforce Training, Salesforce Consulting, Salesforce Course, Salesforce Video, Salesforce Learning
    Bradley Jul 10, 2020
    3,872  Views
    How to Become Salesforce Certified Architect: Achieve More Under Pressure

    How to Become Salesforce Certified Architect: Achieve More Under Pressure

    Video in Salesforce Certifications

    Achieve more under pressure: CTA Edition How to become Salesforce Certified Architect  0:00 Introduction 5:21 What is CTA exam about 10:37 What is CTA Exam…

    Salesforce Training, Salesforce Tutorial, Salesforce Certifications, salesforce, Salesforce Video
    Prafull Jan 17, 2022
    1,864  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.