I have my account entity linked to a custom entity called inspections, I only want these inspections to be created for accounts of a certain type. So when it isn’t that type I want the left hand navigation to this entity to be hidden away. I’ve seen some code that says will hide it away, as long as you have the navID of the item.
I’ve had a crack at hiding it using what i thought could be the ID but it hasn’t worked, so I’m wondering if anyone knows how to get this ID, or if there is another way to do this?
The code I’m using to hide the navigation is below:
var navitem = Xrm.Page.ui.navigation.items.get("nav_ts_inspection");
if (navitem != null)
{
navitem.setVisible(false);
}
From here you can use
CTRL+Fto search for the display name of the item you’d like to hide. This will give youalink that is generated. The Id of this element is what you need to use to show/hide the link.As an example, you can see results of searching for ‘Sub Accounts’ on the Account screen for an installation I am working on at the moment. The Id can be seen and is ‘navSubAct’