function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
CloudGeekCloudGeek 

Nee help for lead conversion code from JavaScript

Hi,

I would like to implement lead convert functionality from javascript, which will be invoked by a button click on a VF Page.

How do we implement this in javaScript to convert lead and get all the lead converted details (AccountId,ContactId,OpptyID) ?
Best Answer chosen by CloudGeek
Naval Sharma4Naval Sharma4
Hi,

Here is the link of blogpost which will be helpful for you. You just need few modification as per your need.
http://blogatsalesforce.blogspot.in/2015/04/convert-lead-using-custom-button.html

All Answers

Naval Sharma4Naval Sharma4
Hi,

You can redirect user to salesforce native lead conversion page. 
On button click call a function.

function convertLead(){
     location.href = '/lead/leadconvert.jsp?retURL=%2F{!Lead.Id}&id={!Lead.Id}';
}

Regards,
Naval
CloudGeekCloudGeek
Hi Sharma,

What if we do not have to redirect User but rather we need to convert as part of process and up on success need to redirect him to the account that is created by convert.
Naval Sharma4Naval Sharma4
Hi,

Here is the link of blogpost which will be helpful for you. You just need few modification as per your need.
http://blogatsalesforce.blogspot.in/2015/04/convert-lead-using-custom-button.html
This was selected as the best answer