function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Suman KuchSuman Kuch 

Related list button with javascript to open a visualforce page.

Hi,
I have a Related list button with javascript code to open a new visualforce page (in Classic).
Type: List Button
Behavious: Execute Javascript
Content Source: OnClick JavaScript
   Code:
var recId = window.location.href.substring(window.location.href.lastIndexOf('/') + 1);
window.location = '/apex/ItemUploadController?recId=' + recId;
In the above javascript getting parent record ID (recId) and opening visualforce page (ItemUploadController) new window.

This button is not appearing in Lightning (Since javascript is not supporting), how can create a list button that opens the visualforce with parent record id passing on URL?
Please advice.

 
Jarosław KołodziejczykJarosław Kołodziejczyk
https://trailhead.salesforce.com/modules/lex_javascript_button_migration/units/javascript_button_alternatives

Here is a really nice trailhead on what can you do in lightning instead of using javascript buttons.