The Hide Tabs community project is one of the more popular projects Aras Labs has published. It demonstrates how to hide a relationship tab on a specific item form by using a custom JavaScript method. This is useful when you want to limit the use of a specific relationship to only a handful of users. However, this approach comes with some downsides. If your ItemType uses several forms, you must add this same method to each individual form. Additionally, using a custom method at all requires some overhead and maintenance.
As of 12.0 SP4, it is now possible to hide tabs without using any custom code at all. In this blog post, we'll cover this new approach that uses CUI in detail. You can also look at the most recent version of the Hide Tabs by Identity community project for an import containing all of the configuration changes we'll make in this post. In these examples, we'll be configuring the Part BOM and BOM Structure tabs of the Part ItemType to be only visible by members of the Administrators identity.
Hide the Relationship Tab
The original approach of using a custom method involved checking if the current user did not belong to a specific identity. In this case, the tab would then be hidden from that user. With the new approach of using purely CUI, this concept will be flipped entirely. We'll start by hiding the tab for everyone, and then configure the CUI of our ItemType to display the tab for only our Administrator users.
Let's take the first step of hiding the relationship for everyone.
- Log in as admin
- Go to TOC > Administration > RelationshipTypes
- Hide the Part BOM relationship
- Search for and open Part BOM
- Edit this relationship and check the Hide for All flag
- In the item toolbar, click the button and select Properties
- Click Copy ID and store this somewhere as we'll need it later
- Repeat the steps above for the Part MultiLevel BOM relationship
Use CUI to Display the Tab
If we go and open a Part now, we can see that the Part BOM and BOM Structure relationship tabs are no longer visible.
This is currently true for every user, so now let's re-enable these tabs for only our Administrators. To begin with, we'll need to add a CUI section to tell the Part ItemType that it's going to have custom tabs.
- Navigate to TOC > Administration > ItemTypes
- Search for and open the Part ItemType
- Select the Client Style relationship tab and open the item here
- This is the item that controls all of the ItemType-specific CUI for Part
- In this Presentation Configuration, select the cui_PresentConfigWinSection relationship tab
- Create a new related item here to indicate that the Part view will have custom CUI
- Classification – Data Model
- Name – labs.part.itemview
- Location – ItemView
- For Identity – World
- Open this new related item
- In the cui_WindowSectionControl tab, add a new item to represent the Part BOM relationship
- Type – Tab Element Control
- Name – labs.part_bom.tabelement
- Label – Part BOM
- This will be the label on the relationship tab
- Additional Data – {"relTypeId": "159C6D88795B4A86864420863466F728"}
- The ID here should be the same one you copied from the Part BOM RelationshipType earlier
- Parent – ItemView.RelationshipAccordionTabs
- Action – Add
- For Identity – Administrators
- This is the Identity that will be able to see this tab
- Repeat the same steps to add a new item for the BOM Structure relationship
- Type – Tab Element Control
- Name – labs.bom_structure.tabelement
- Label – BOM Structure
- Additional Data – {"relTypeId": "567E4149FBF74DACA0B0C4C9B1E79A3B"}
- This should be the same ID you copied from the Part MultiLevel BOM relationshiptype earlier
- Parent – ItemView.RelationshipAccordionTabs
- Action – Add
- For Identity – Administrators
- Save and close this item
- Save and close the Presentation Configuration
After following these steps, it should look similar to the screenshot below.
Confirm the Changes
Since we're already signed in as admin, let's open a Part to check if we can see these tabs now.
While we're at it, let's also make sure these tabs are hidden for a user who is not an Administrator. When we log in as this user and open a part, we indeed can no longer see the Part BOM or BOM Structure tabs.
Conclusion
CUI is a powerful tool to have at your disposal that is only growing in functionality and responsibility. If you're looking for more information on how to use CUI to configure other areas inside of Aras Innovator, please check out all of our blog posts on CUI.