I have custom button that runs some javascript code, I added it to page layout in Salesforce classic. But when I switch to lightning, on record page my button is missing. I tried creating custom lightning page, but I can only add lightning components to it. How can I add a button to standard lightning layout?

I have built a button that redirects to another web application using some values from current record and I need this button to be on record page layout, but in lightning too.


You can't. Javascript buttons aren't supported by Lightning. Lightning pages are single page applications. Most everything in Lightning is done using Actions.

See Page Layouts in Lightning Experience from Salesforce Help where it explicitly says:

Custom buttons that call JavaScript aren’t supported in Lightning Experience.

UPDATE - Use the Lightning Experience Configuration Converter recreates your org’s JavaScript buttons as Lightning components, quick actions, or other solutions — all without touching your original buttons.

See Salesforce blog about this.

  • 1
    Can you add some documentation to back this up? You're in the Low Quality Posts queue for this one. – Adrian Larson Jul 26 '16 at 16:23
  • @AdrianLarson Will do, let me go find a link. – crmprogdev Jul 26 '16 at 16:48
  • @crmprogdev So the only option for me to run my js is to create custom lightning component that I will add to lightning page? – Vladyslav K Jul 26 '16 at 20:55
  • To be honest, I'm not certain that you'll be able to do it with a Lightning Component as I've not attempted anything like that myself and I believe there are some limitations on what part of the window a component has access to, but it would seem that would be the most likely approach to take if you need to try and pre-populate values from a current record. – crmprogdev Jul 27 '16 at 12:42
  • help.salesforce.com/… <--- The red warning under Standard and Custom Buttons – Mattisdada Jul 27 '17 at 5:33

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.