Field Update: Replace javascript button for Lightning UI and Classic

2:50 PM

A most common use case for javascript buttons is a simple field update, onclick of the button a field/fields are updated and the page is refreshed.

With the onset of Lightning javascript buttons are no longer supported and hence have to be replaced. A simple solution would be to use Visualforce which works both in the Lightning UI and classic. However, there is a known issue where the page does not reload/get the updated information when you a do a page redirect using PageReference in Visualforce.

Know Issue:

I hope the issue gets fixed soon. In the meanwhile, here is a code snippet to replicate the same functionality using lightning components.


Under Buttons, Links and Actions for the object create a new action and link it to the lightning component created above.


Use Visualforce or a simple Visual Flow to replicate the field update behavior in classic. Here is a link to get you started with Flows