+ Start a Discussion
praveen jha 42praveen jha 42 

Replicate a javascript button for Lightning version-Urgent

I have requirement where I have to replicate a javascript button for Lightning version. As we know, we cannot have Javascript button in Lightning. I'd like to have the same button in Lightning version. Below is the Javascript code for the button in Classic version.

Any help is appreciated!

Many Thanks!


if("{!$Profile.Name}" == "System Administrator") 

if (confirm("Are you sure you want to Create an Account in Oracle?") == true) 

var acctObj = new sforce.SObject("Account"); 
acctObj.Id = '{!Account.Id}'; 

acctObj.Create_Account_in_Oracle__c = true; 

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

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



alert("Account Creation Process has been submitted to Oracle"); 

Khan AnasKhan Anas (Salesforce Developers) 
Hi Praveen,

Greetings to you!

You can use Lightning Experience Configuration Converter to convert JavaScript buttons to lightning. Please refer to the below links which might help you further with the above requirement.




There are other options also to replace the javascript button in lightning. You can use Quick Actions, Custom Buttons, or Apex. Go through this trailhead module to understand the alternatives available:
Lightning Alternatives to JavaScript Buttons (https://trailhead.salesforce.com/en/modules/lex_javascript_button_migration)

Also, Please refer to the below link:


I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas
praveen jha 42praveen jha 42
Hi Khan Anas. Thanks for your quick reply.
I have used lightning converter, but it's partially convert not fully. Can you plesae send me the code to get the solution as I am new to lightning.
Aman PathakAman Pathak

I will not suggest code  for this , you can do it with cloud flow. 
It has screen  where you can add your message and then update the Same account . It is less complex as compared to code and can be called from a quick action. Easy Pick ad drop elements.

Let me know if this helps or you need help on this I can add screenshot of a Demo acc upd with screen message.