[SalesForce] Show a button that shows on related list

I wonder if we could create a button or list that can be displayed on the related section.
Now, If a user clicks on that button then a component should be called or certain record of that object needs to changed.
enter image description here

Can we do this in Lightning?

Best Answer

Yes, you can create a List Button on the object, then add it to the related list for the object where the related list appears. Note that this process will add the button in both LEX and Classic, so you will not need to write two separate versions.

Create a Visualforce Page

Create a Visualforce page that has the recordSetVar and standardController attributes defined. This allows the Visualforce page to be referenced by a list button. This page should use the StandardSetController's getSelected method to retrieve the records that were selected (if necessary).

Create a Custom Button

Create a custom button on the object that you want the button to appear for. In your case, it is the Access Request object. If you want users to be able to select which records to revoke, check the "Show checkboxes" option on the button, which allows users to select up to 200 records and then click the button to hand those ID values to the Visualforce page defined above.

Add to Related List

Finally, go to the parent object, edit its page layout, and add the custom button to the related list by editing it, choosing the Buttons category, and adding your custom button to the list of selected buttons.

You can read more about it in Adding Custom List Buttons using Standard List Controllers.