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
bhanu_prakashbhanu_prakash 

javascript in lightning

Hi Team,
Iam using javascript button on click custom button on lead object, when lead status is new need to redirect into a visualforce page with id. 
below code is working in classic 
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/29.0/apex.js")}
var status = '{!Lead.Status}';
if (status != 'New') {
    alert('Please ensure this Lead is at the New Status prior generating the reservation form');
}
else{
   window.open('/apex/Downloadaspdf?retURL={!Lead.Id}&id={!Lead.Id}&noopptt={!Lead.LastName&", "&Lead.FirstName}'); 
}
I have idea that javascript buttons will not work in lightning 
how can i move it into lightning  without using lightning component

any help :) 

Thanks for advance 
IGNACIO SARMIENTO LOSADA1IGNACIO SARMIENTO LOSADA1
Hi bhanu_prakash,

With Lightning you have to move this script to controller.js component inside your lightning component. Neither line 1 nor 2 are required to make it work. You should do some updates in your code to map the variables.

Please, let me know if this helps you.

Thanks
Regards,
Ignacio