I am trying to create a button on a list view in salesforce that, when clicked, will open a popup dialog of sorts. I would expect the button to be at the top of the list view, directly alongside the 'New' button, and the dialog to look similar to the dialog / popup that appears when clicking 'New' (with different content and fields of course). The goal is that the popup would contain a dropdown list, allowing the user to select a 'List__c' record, and then click a 'Finish' button. When clicking finish, all the checked records from the list view (in this case they are account records) are created as related fields to new entries on the 'List__c' object. Just to summarize, this means that there has to be a way to pass all the checked values, AND the value selected on the drop down.

I have been researching solutions to this. I really would like to use Lightning Web Components, because they are more modern and I have seen several sources indicate that they are the recommended solution, as Visualforce pages are getting sort of old and out dated. I have figured out the basics of LWC, but I am stuck on the list view button piece of it. I figured out how to call a LWC from actions, but it appears that actions only show up on the record instance, NOT on the list view. So if I change my approach to use a button, there are options for custom javascript or a visualforce page. Salesforce discourages the custom javascript due to security issues, so I guess that option is out. Which leaves the only option for the custom list button to call a visualforce page.


Can anyone give me any direction on this? First, would it be bad practice to implement a new solution using visualforce (and therefore the button on the list)? Or, ideally, is there a way I can use the button to call a LWC from a list view (since actions don't work for the list view)? Also of thought, if the only way to do this is the call a visualforce page with the button, is there a way I could use the visualforce page to call the LWC? Also, a concern I have with the Visualforce page is that I want this popup to remain over the current page and not redirect.

Any thoughts on the best approach for this would be awesome. Thanks!



You must log in to answer this question.