Hide Specific Buttons on Order Products Related List?

Question:
Is it possible to control the visibility of the “Add Products” and “Edit Products” buttons on the Order Products related list?
The only solution we have found so far is to hide both buttons by disabling the “Show list view action bar” option. We then created two duplicate related lists, one visible and the other hidden under a custom permission. However, this approach does not allow us to hide only one button while keeping the other visible.
Is there a way to hide a single button or selectively show one of the buttons?
We understand that users without the necessary permissions will encounter errors if they click the restricted buttons. However, we would like to prevent these errors by hiding the corresponding buttons altogether.
Answer:
Salesforce does not provide a direct way to hide individual buttons on the Order Products related list, but workarounds exist. Options include using a custom Lightning Web Component (LWC) to control button visibility, overriding standard buttons with Visualforce or LWC, or using duplicate related lists with custom permissions. While permission-based restrictions can prevent actions, they do not remove the buttons, making UI customization the best approach.
Master Salesforce with expert-led training at CRS Info Solutions in Salesforce training in Hyderabad. Gain hands-on experience in Admin, Developer (Apex), and Integration—join a free demo today!!!
However, here are some potential workarounds:
1. Dynamic Actions (Not for Related Lists)
Dynamic actions in Lightning Experience allow controlling button visibility based on criteria like profiles or permissions. Unfortunately, this does not apply to related lists, so this solution is not feasible in this case.

2. Custom Lightning Component
A fully customized Lightning Web Component (LWC) or Aura component can be used to display related list records while offering complete control over the available buttons. In this approach, you would:

You can query the related Order Products records using Apex and display them in a custom Lightning Web Component (LWC). The LWC can be designed to show the related list while providing complete control over button visibility. Using Apex or JavaScript, you can check user permissions and dynamically show or hide the “Add Products” and “Edit Products” buttons, ensuring only authorized users see the relevant actions.

3.Override Standard Buttons with Visualforce or LWC
If you only need to control the behavior of the “Add Products” or “Edit Products” actions, you can override these buttons with a custom Visualforce page or LWC that includes logic to check user permissions before displaying the button. However, this does not directly remove the buttons from the related list.
4. Duplicate Related Lists with Custom Permissions (Current Approach)
The method you described—creating two related lists and controlling their visibility using custom permissions—remains a valid workaround. However, as you noted, this does not allow hiding just one button at a time.
5. CSS and JavaScript via a Custom Button (Unsupported)
If you embed JavaScript inside a Visualforce page that runs within the record page, you might be able to hide specific buttons using DOM manipulation. However, this is not recommended because it is unsupported and may break in future Salesforce updates.
6. Permission-Based Restriction (Error Prevention)
While not hiding the button, ensuring users do not have the necessary permissions (e.g., removing Create/Edit access on the Order Product object) will prevent them from performing these actions. Although users will see the buttons, they will receive a permission error when clicking them.
Currently, the best approach depends on whether you want a fully supported method (custom LWC) or a workaround using duplicated related lists and permissions. If Salesforce introduces more flexible control over related list buttons in the future, this limitation may be resolved natively.
Summing Up
Salesforce does not provide a built-in way to hide individual buttons on related lists, but workarounds exist. The most robust solution is using a custom Lightning Web Component (LWC) to fully control button visibility based on user permissions. Alternatively, duplicating related lists with custom permissions can hide all buttons but not selectively remove one. Overriding standard buttons or using unsupported CSS/JavaScript hacks may work but are not ideal. Ultimately, while permission-based restrictions prevent unauthorized actions, they do not eliminate the buttons, making a custom LWC the best long-term approach for precise control.
Launch Your Salesforce Career in Hyderabad’s Booming Tech Hub
Hyderabad has emerged as a major hub for IT and cloud computing, with Salesforce leading the charge in digital transformation. As companies increasingly rely on Salesforce for CRM, AI, automation, and integrations, the demand for certified professionals is soaring. Top firms like Deloitte, Accenture, Infosys, TCS, and Wipro are actively seeking skilled Salesforce experts, making specialized training a powerful catalyst for career growth.
If you’re ready to build a thriving Salesforce career, the right training can make all the difference. CRS Info Solutions provides industry-focused Top Salesforce training Institutes in Hyderabad, covering Admin, Developer (Apex), and Integration modules. With expert guidance, hands-on projects, and real-world case studies, this program equips you with the skills to excel in Hyderabad’s competitive job market. Take the next step—enroll today and open the door to limitless opportunities in the Salesforce ecosystem!!!


