The only option in Salesforce to place a Custom Button on a list view is to create a Visualforce page and then call your required function from there.

But the issue I am facing is, I want to open a Primary tab in a console view from List view.

So list view shown here. enter image description here

And the highlighted custom button is a Visualforce page.

<apex:page standardController="Case" extensions="NagsCreateCaseController" recordSetVar="test" action="{!resetToListView}">

public class NagsCreateCaseController {

    public NagsCreateCaseController(ApexPages.StandardController controller) {
        System.debug('Empty constructor need for Manual Assignment Button');

    public NagsCreateCaseController(ApexPages.StandardSetController standardController){


    public PageReference resetToListView() {
        return new ApexPages.Action('{!List}').invoke();

The issue is, I would not want to redirect anywhere when the button is clicked and just fire a postMessage, so that I can listen to this post message and open console tabs from utilitybar.

But as we know action gets called even before the page gets rendered, so technically it just returns to the same list view page even before the <script> gets called.

How do I call javscript right before action gets called?

If I dont put action, then it redirects the main page to empty page, which is not good.

enter image description here

I tried lightning actions, but that does not help as it wont get shown in List view.

Javascript actions also does not get on list view.

  • You could try moving the action into an action function on the page (apex:actionFunction) that you can then call in the script after you've posted your message? Commented Jun 18, 2022 at 4:16
  • 1
    @KrisGoncalves No even that wont work and does not work, because if we let VF page render then it loads in Tab0 and shows a blank page as shown on 2nd image. Commented Jun 18, 2022 at 4:25

1 Answer 1


Anyways I tried slightly different approach here.

For a specific Case Record I tried Global Action approach. Though the issue is it wont be available on List view or Related list buttons, but it would serve the purpose of overriding Create Case page for a specific record type. And users will be trained to use Global Action instead for creating these type of Cases.


Which opens on right docker, but user needs to click maximize to open it as a modal. But it will work out.

<aura:component description="TestButtonForFCase" implements="force:lightningQuickAction">
    <c:customNewButtonCopy oncancelHandlerDispatched="{!c.handleCancelHandlerDispatched}" />

    handleCancelHandlerDispatched: function (component, event, helper) {
        const dismissActionPanel = $A.get("e.force:closeQuickAction");
        if(dismissActionPanel) {

Strange part is this custom list view is basic thing in lightning but salesforce yet does not support it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .