I am new to salesforce lightning. I have a button in classic that update the lead status. But I am not been able to figure out how the same thing will be written in lightning. Here is my classic version code


var leadObj = new sforce.SObject("Lead");  

leadObj.Id = '{!Lead.Id}';  
leadObj.Telesales_Converter__c = '{!$User.Id}';  
leadObj.Conversion_Date__c = new Date(); 
leadObj.Status = 'Bills Promised'; 

var result = sforce.connection.update([leadObj]);  

if (result[0].success=='false') {  
} else {  

There are several ressources provided by Salesforce to help you convert your Javascript Button. Also, there are different ways to convert your button, thus please see the references:

Trailhead: https://trailhead.salesforce.com/content/learn/modules/lex_javascript_button_migration

Lightning Experience Configuration Converter: https://developer.salesforce.com/blogs/2018/06/convert-javascript-buttons-to-lightning-friendly-alternatives-with-the-lightning-experience-configuration-converter.html

Scan Your Org for JavaScript Buttons and Links to get general suggestions: https://help.salesforce.com/articleView?id=lcc_javascript_buttons_scan.htm&type=5

General information: https://help.salesforce.com/articleView?id=lcc_javascript_buttons_overview.htm&type=5

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.