Ribbon Workbench: Hide Ribbon Subgrid Buttons For A Specific Entity Without Code

Are you, like me, one of those who has hidden ribbon buttons for certain entities using JavaScript? Well, you shouldn’t have to and it is not as complicated as you think! For this specific case, I have always hidden the button using JS because it was easy and quick.

In my example below, I am trying to hide ‘Add Contact’ button from Contact Subgrid on ContosoTableOne entity. Note that both of the alternatives below produces the same result.

Ribbon Workbench: Ensure that you have selected the correct button context, meaning the subgrid buttons.
Ribbon Workbench: Calling Ribbon_HideBasedOnEntity_Solution1 with EntityLogicalName as parameter
Ribbon Workbench: Calling Ribbon_HideBasedOnEntity_Solution2 with PrimaryControl as parameter
ContosoTableOne Form: ‘Add Contact’ ribbon button is no longer visible on the SubGrid.

Not really here to tell you to stop doing this, because there’s an upside to this! By leaving the responsibility to JavaScript, you have the ability to update the change a lot quicker 💨. It takes few seconds to update a WebResource and perhaps 2-5min to publish ribbon workbench changes (even more if you have multiple entities in the solution). And sometimes, the Ribbon Workbench tool can be moody and throw an error ❌ due to whatever reason.

Here’s the alternative way (no code) hide the ‘Add Contact’ subgrid button from ContosoTableOne entity using EntityRule.


Ribbon Workbehnch: Hide if the PrimaryEntity is ContosoTableOne, in the context of the SubGrid.

If you want to do the opposite, to display the ribbon subgrid button for one specific table? Set Default to True and InvertResult to False!

As for PowerFx, I couldn’t really find a way to do the same (without code) because currently there is no way to provide the event context using formula. Unless the button runs JavaScript action.


Happy Ribbon Workbench-ing!


Leave a comment

Blog at WordPress.com.

Design a site like this with WordPress.com
Get started