I have created a Custom Detail button on a Custom Object in salesforce classic. But now i am not able to see this button on lightning. I am not sure which LTX action should i create for my button.

As far i know custom javascript buttons are not supported in LTX but there must some way to implement this detail button in LTX.

  var message = new sforce.SingleEmailMessage(); 
    message.targetObjectId = "0031I00000BmAhv"; 
    message.toAddresses = "{!Worker__c.Email__c}"; 
 message.templateId = "00X1I000000ZIpT"; 
 message.whatId = "{!Worker__c.Id}"; 
  var startDate = "{!Worker__c.Email_Start_Date__c}"; 
   var EndDate = "{!Worker__c.Email_End_Date__c}"; 
   var sDate = new Date(startDate); 
   var eDate = new Date(EndDate); 
    if(startDate == '' || EndDate == ''){ 
    alert("Please Enter Email Start Date & End Date !!"); 
     }else if(sDate > eDate){ 
     alert("End Date Must be higher than Start Date !!"); 
     var result = sforce.connection.sendEmail([message]); 
     if(result[0].success == 'true') 
      var p = new sforce.SObject('Worker__c'); 
         p.id = "{!Worker__c.Id}"; 
       p.Email_Start_Date__c = null; 
      p.Email_End_Date__c = null; 
        result = sforce.connection.update([p]); 
       alert("Email Sent Successfully !!"); 
          } else 
      alert("Email Sending Failed"); 

1 Answer 1


Sales force, however, is not allowing the use of JavaScript buttons in the Lightning Experience for security reasons.

So You can build a quick actions for lightning components.

or Replace java script button with url button

Please go through trailhead:


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .