I have created a custom detail page button(onclick calling Javascript) that is showing in salesforce classic experience but not in lightning experience. I have added the button to the page layout. I don't understand why this is happening. Can some one explain it to me ? There are screenshots of the detail pages :


enter image description here

Classic :

enter image description here

1 Answer 1


I think you can not call JS from a button in Lightning.

When transitioning from classic to lightning one of the things you should take care is exactly that.

SF considers calling JS from a button to be security risk and hard enforce good coding practices there.

You should design the same functionality using hopefully Process or Flow. If they are not sufficient try with a custom apex action in Flow to do what you need there.

Or maybe custom Lightning component to make easier transition if you use Js a lot for your functionality.

  • Thanks for replying @Boris , I just updated my detail button on which I was calling JS , I just calling my VF page directly May 11, 2021 at 17:03

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.