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?

1 Answer 1


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.

  • @sfdxfox, Thanks for the answer but instead of putting checkboxes can i add a custom button or a link called Revoke on all the Rows (i.e. on all AccessRequest records). Now when a user clicks on that Revoke link, controller gets the id of the record and does its job.
    – user51525
    Commented Feb 9, 2018 at 4:53
  • @karna Yes, the page gets access to the ID of the record that it was called from, if you'd like to do that.
    – sfdcfox
    Commented Feb 9, 2018 at 5:16
  • @sfdxfox, but can we replace the checkboxes by a revoke link. The Revoke link should appear in all the rows (Access request record) and if a user clicks on that record, then controller gets called (without showing the details of clicked record)
    – user51525
    Commented Feb 9, 2018 at 5:23
  • @karna Oh. Not directly, no. You'd need a custom hyperlink formula field on the record. The button with checkboxes is the best you can do out of the box. As a custom field, you'd specify a hyperlink to a Visualforce page to do the actual revoking.
    – sfdcfox
    Commented Feb 9, 2018 at 5:52

You must log in to answer this question.