This article describes how to create a custom list view button to apply a specific business policy to one or more manually selected records, as shown in this image:

We follow the approach currently recommended by Salesforce for the development of custom list view buttons. The main steps are:

  • Create a custom Visualforce page
    We provide a copy paste template -- no coding skills required!
  • Create a custom list view button referencing the page
  • Add the list view button to the List View search layout

You will need to create one Visualforce page per business policy, as Visualforce list view buttons do not allow for any parameterization.

NOTE: if you are looking to apply a policy named Assignment to the Lead object, you are in luck! The app includes a sample Visualforce page and button that are ready to use. You can skip directly to the final step to add the AssignList button to the List View search layout for the Lead object.

In all other cases please follow the steps outlined below to create a new page and button for your policy.

Create a custom Visualforce page

The first step is to create a Visualforce page to use in the list view button. As an example we will describe the creation of a button to invoke a policy named Assignment on the Account object. In the examples below please replace the text in bold with the applicable object and policy names.

To create the page:

  • Locate the Visualforce Pages section in Setup
  • Click 'New' to create a new page
  • Choose any valid Label and Name, for instance: 
    • Name: ApplyPolicyToList_AccountAssignment
    • Label: ApplyPolicyToList - AccountAssignment
  • Leave the Available for Lightning Experience, Lightning Communities, and the mobile app and Require CSRF protection on GET requests checkboxes unchecked
  • Enter the following content in the Visualforce Markup section:
    <apex:page standardController="Account" recordSetVar="Accounts" showHeader="false" sidebar="false">
       <DecsOnD:ApplyPolicyToListComponent objectName="Account" policyName="Assignment" records="{!selected}"/>

    Please replace the text in bold with the applicable object and policy names.
  • The result should look like this:
  • Click Save

Create a custom list view button referencing the Visualforce page

Once you have created the custom Visualforce page, you need to create a button to reference it.

  • Type 'Object Manager' into the Setup Quick Find box and then select it.


  • Then select the object for which you want to add the button (for instance 'Account') and the 'Buttons, Links, and Actions' followed by 'New Button or Link'
  • Select a Label and Name of your choice, as well as the following:
    • List Button: True
    • Display Checkboxes (for Multi-Record Selection): True
    • Behavior: Display in existing window with sidebar
    • Content Source: Visualforce Page
    • Content: the page you created in the previous step
  • It should look something like this:
  • Click 'Save', then OK in the dialog that appears

Add the button to the List view search layout for the desired object

  • If necessary navigate back to the relevant object in Object Manager
  • Then select 'Search Layouts', click the down arrow next to List View and select 'Edit'
  • Select the button you created above, and click the right arrow (Add) button

    NOTE: the app includes one default button for the Lead object with the label Assign: this button applies a policy named Assignment
  • Click Save

You should now see the Assign Accounts button on the list view.

NOTE: custom buttons do not appear on the standard 'Recently Viewed' list view -- but they should be visible on all other list views.