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"); 

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:


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.