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
Foram Rana RForam Rana R 

Add Custom Button In List View

User-added image
While clicking on button called Visualforce page.
Best Answer chosen by Foram Rana R
Khan AnasKhan Anas (Salesforce Developers) 
Hi,

Greetings to you!

1. From Setup, click Object Manager, then click Lead.
2. Click Buttons, Links, and Actions, then New Button or Link.
3. Name the button.
4. Select List Button.
5. Content Source: Visualforce
6. Select your visualforce page. The visualforce page should use the object's standard controller.
<apex:page standardController="Lead" recordSetVar="leads">
   <apex:form>
      <apex:pageBlock title="Edit Stage and Close Date" mode="edit">
         <apex:pageMessages />
         <apex:pageBlockTable value="{!leads}" var="opp">
            <apex:column value="{!opp.Name}"/>
            <apex:column headerValue="Email">
               <apex:inputField value="{!opp.Email}"/>
            </apex:column>
            <apex:column headerValue="Phone">
               <apex:inputField value="{!opp.Phone}"/>
            </apex:column>
         </apex:pageBlockTable>
      </apex:pageBlock>
   </apex:form>
</apex:page>
7. Add button to the layout:
Stay in the Lead object, click Search Layouts for Salesforce classic menu, then select Edit under ListView.
Add your button to the "Selected Buttons".
Save.

Note: Mass actions aren’t supported on the most recent records list. They are only available on list views.

Please refer to the below links which might help you further with the above requirement.

https://developer.salesforce.com/blogs/developer-relations/2016/09/take-the-first-steps-ways-you-can-replace-javascript-buttons.html

https://trailhead.salesforce.com/en/content/learn/modules/lex_customization/lex_customization_buttons_links

https://www.simplysfdc.com/2018/03/salesforce-list-view-mass-action-in.html

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas

All Answers

Khan AnasKhan Anas (Salesforce Developers) 
Hi,

Greetings to you!

1. From Setup, click Object Manager, then click Lead.
2. Click Buttons, Links, and Actions, then New Button or Link.
3. Name the button.
4. Select List Button.
5. Content Source: Visualforce
6. Select your visualforce page. The visualforce page should use the object's standard controller.
<apex:page standardController="Lead" recordSetVar="leads">
   <apex:form>
      <apex:pageBlock title="Edit Stage and Close Date" mode="edit">
         <apex:pageMessages />
         <apex:pageBlockTable value="{!leads}" var="opp">
            <apex:column value="{!opp.Name}"/>
            <apex:column headerValue="Email">
               <apex:inputField value="{!opp.Email}"/>
            </apex:column>
            <apex:column headerValue="Phone">
               <apex:inputField value="{!opp.Phone}"/>
            </apex:column>
         </apex:pageBlockTable>
      </apex:pageBlock>
   </apex:form>
</apex:page>
7. Add button to the layout:
Stay in the Lead object, click Search Layouts for Salesforce classic menu, then select Edit under ListView.
Add your button to the "Selected Buttons".
Save.

Note: Mass actions aren’t supported on the most recent records list. They are only available on list views.

Please refer to the below links which might help you further with the above requirement.

https://developer.salesforce.com/blogs/developer-relations/2016/09/take-the-first-steps-ways-you-can-replace-javascript-buttons.html

https://trailhead.salesforce.com/en/content/learn/modules/lex_customization/lex_customization_buttons_links

https://www.simplysfdc.com/2018/03/salesforce-list-view-mass-action-in.html

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas
This was selected as the best answer
Ajay K DubediAjay K Dubedi
Hi Foram,

I have gone through your question. Follow the below steps - 

1. Go to setup.
2. Go to the object manager.
3. Select your object.
4. Click on Buttons, Links, and Actions.
5. Click a new button or link.

Then fill the details
User-added image

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Ajay Dubedi
www.ajaydubedi.com
azar khasimazar khasim
hello Ajay,
 
had u found any solution for the issue you faced in it.
If found please provide me the solution.

Regards,
Azar
Sharad Chandra Maheshwari 1Sharad Chandra Maheshwari 1

@Khan Anas or anybody who can help- All examples that I have seen so far show how to add a custom button/action on Leads List View. I am looking for a way to launch a flow from a custom buttom/action from Account List View?

The Flow is to create account and related contact records and it needs to happen only through a flow, as the customer wants point and click customization.

User-added image

So far, I have only been able to launch the flow from within a record- by adding the action on the account page layout. However, my requirement is to launch the flow from the Account List View itself and not requiring the user to first have to select any other record. I have also tried creating a VF page to launch the flow from.

The issue that I am running into is

1- I do NOT see 'List View' as an option when I navigate to 'Search Layouts' on the Account Object and the 'Default Layout' does not have the custom button that I created
User-added image

Default Layout

User-added image

2- I do see 'List View' listed when I navigate TO 'Search Layouts for Salesforce Classic' on the Account Object, however, the button to launch flow still does not show up under custom buttons and the only buttons that show up are related to either creating/updating a record

User-added image

User-added image

Direction on how to proceed ahead is greatly appreciated. Thank you in advance!

Sharad Chandra Maheshwari 1Sharad Chandra Maheshwari 1
I was able to solve the issue I have mentioned above as per the description over here (https://developer.salesforce.com/forums/ForumsMain?id=9062I000000QwxyQAC)
 
Robin Hood 10Robin Hood 10
Very detailed posting ... Loved it.
Regards, My Boy Apk for Games.
rohit rahulrohit rahul
I enjoy reading this post, thanks for the stuff.
Cat Mouse Apk (https://www.catmouse.fun/catmouse-apk/)for Movies.
Виктор КозияткоВиктор Козиятко
If you want to create new button for custom object you can look at my examples.
<apex:page standardController="Email_Log__c" extensions="ResendAllFailedEmails" recordSetVar="sobjects">
<h1>Congratulations</h1>
This is your new Page
</apex:page>
 
public  class ResendAllFailedEmails {
    public ResendAllFailedEmails(ApexPages.StandardSetController controller) {

    }
}

After this steps the VF page started showing in the content section when creating the new custom button.