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
Rajasree JayarajRajasree Jayaraj 

Replace Javascript button | A URL button which validates a field prior to calling a URL


I am figuring out ways to replace our javascript buttons to lightning compatible one. We have quite a lot of javascript button one of which is "Send with Docusign" that lets a user send a contract using Docusign. I'm calling the right docusign template using this custom button & passes some parameters like recipient email. I have a part of code that validates if the contract is approved by the leads before it could be sent to client with docusign. Something like this:


var contrObj = new sforce.SObject("Contract"); = "{!Contract.Id}"; 
var ContrStatus="{!Contract.Contract_Status__c}"; 
var profile ="{!User.Profile}"; 


alert("The contract should be approved before sending for signature"); 

window.location.href = '/apex/dsfs__DocuSign_CreateEnvelope?DSEID=0&SourceID={!Contract.Id}&CRL=Email~{!Contract.Business_Contact_Email_Formula__c};FirstName~{!Contract.Business_Contact_First_Name__c};LastName~{!Contract.Business_Contact_Last_Name__c},.....................'; 

Now, I need to replace this javascript button with components that are lightning compatible (since we are plannign to switch to Lightning) . I'd like to know what are the possible options?

Thank you very much in advance!

Hi Rajasree, 

This should help you

Hey SandboxHey Sandbox
Hi Rajasree,

Button (with JavaScript) is not available for Lightning use. You can not override this button for Lightning use. It is for Classic use only.
You can see this Salesforce documentation reginding this:

For this issue, You have to create a Lightning component to develop this functionality. 
Refer this links for more:

I think above all reference links will help you on this issue.