Hiding subgrid ribbon button for specific entity

 

Some time ago as a one part of customizations I got a request to hide AddNew button on subgrid ribbon when parent entity is opportunity. Piece of cake I thought. But it was not.

Why?

My first thought:

  • open RibbonWorkbench
  • add display rule for a EntityRule
  • set entity name
  • publish

 

When I have refreshed the page I was so surprised that the button is still there. Maybe I have made a spelling error in entity name. Double check but no. When investigating the issue I found out that it is just not working. No matter what.

Solution

Finally I have changed the rule to use FormEntityContextRule .

<FormEntityContextRule EntityName="opportunity" InvertResult="true" />

After that rule was working, button was hiding and I was happy.

1 thought on “Hiding subgrid ribbon button for specific entity”

Have an own opinion?