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: https://success.salesforce.com/issues_view?id=a1p3A0000001C8QQAU&title=data-not-updated-in-ui-after-an-apex-update-in-lightning-experience

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

LIGHTNING:








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

CLASSIC:


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

https://developer.salesforce.com/docs/atlas.en-us.salesforce_vpm_guide.meta/salesforce_vpm_guide/vpm_records_update.htm

0 comments