10

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.

1 Answer 1

10

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.

6
  • 1
    Can you add some documentation to back this up? You're in the Low Quality Posts queue for this one.
    – Adrian Larson
    Commented Jul 26, 2016 at 16:23
  • @AdrianLarson Will do, let me go find a link.
    – crmprogdev
    Commented Jul 26, 2016 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? Commented Jul 26, 2016 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
    Commented Jul 27, 2016 at 12:42
  • help.salesforce.com/… <--- The red warning under Standard and Custom Buttons
    – Mattisdada
    Commented Jul 27, 2017 at 5:33

You must log in to answer this question.

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