Problem: Came across the situation in which I want to
hide a button on Form.
Solution:
To solve this issue either you can write javascript to hide button or customize the ribbon. I realized the good way to achieve this task was to customize the ribbon.
Solution:
To solve this issue either you can write javascript to hide button or customize the ribbon. I realized the good way to achieve this task was to customize the ribbon.
a) If we want to hide
the button on the MainTab of entity then the process is simple as follows:
- Create the empty solution and add the entity from which you want to remove the button (for eg. Accounts)
- Export the solution, unzip and open Customization.xml.
- Locate “RibbonDiffXml”. Write the following code inside the node.
<RibbonDiffXml>
<CustomActions>
<HideCustomAction Location="Mscrm.Form.account.Assign"
HideActionId="form.HideAction" />
</CustomActions>
Here location indicates the button that you want to hide. We
have taken an example to hide “Assign” button on MainTab.
4. Save the file.
5. Zip the solution, Import
and Publish the changes.
b) But what If we want to
hide button on the subgrid section. Say we have “TestEntity” related to
Accounts and I want to hide the buttons which says “Add new TestEntity”.
1. Create empty solution and
export “TestEntity”.
2. Open Customization.xml
and locate “RibbonDiffXml”.
3. Include the following code inside the node.
<RibbonDiffXml>
<CustomActions>
<HideCustomAction Location="Mscrm.SubGrid.TestEntity.AddNewStandard"
HideActionId="Subgrid.HideAction"
/>
</CustomActions>
So this action will hide the button from subgrid of all entities
related with “TestEntity”.
4. Save the file.
5. Zip the solution, Import
and Publish the changes.
Thanks,
No comments:
Post a Comment