Hiding Tabs Using CUI

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.

  1. Log in as admin
  2. Go to TOC > Administration > RelationshipTypes
  3. Hide the Part BOM relationship
    1. Search for and open Part BOM
    2. Edit this relationship and check the Hide for All flag
    3. In the item toolbar, click the  button and select Properties
    4. Click Copy ID and store this somewhere as we'll need it later
  4. 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.

  1. Navigate to TOC > Administration > ItemTypes
  2. Search for and open the Part ItemType
  3. Select the Client Style relationship tab and open the item here
    1. This is the item that controls all of the ItemType-specific CUI for Part
  4. In this Presentation Configuration, select the cui_PresentConfigWinSection relationship tab
  5. Create a new related item here to indicate that the Part view will have custom CUI
    1. Classification - Data Model
    2. Name - labs.part.itemview
    3. Location - ItemView
    4. For Identity - World
  6. Open this new related item
  7. In the cui_WindowSectionControl tab, add a new item to represent the Part BOM relationship
    1. Type - Tab Element Control
    2. Name - labs.part_bom.tabelement
    3. Label - Part BOM
      1. This will be the label on the relationship tab
    4. Additional Data - {"relTypeId": "159C6D88795B4A86864420863466F728"}
      1. The ID here should be the same one you copied from the Part BOM RelationshipType earlier
    5. Parent - ItemView.RelationshipAccordionTabs
    6. Action - Add
    7. For Identity - Administrators
      1. This is the Identity that will be able to see this tab
  8. Repeat the same steps to add a new item for the BOM Structure relationship
    1. Type - Tab Element Control
    2. Name - labs.bom_structure.tabelement
    3. Label - BOM Structure
    4. Additional Data - {"relTypeId": "567E4149FBF74DACA0B0C4C9B1E79A3B"}
      1. This should be the same ID you copied from the Part MultiLevel BOM relationshiptype earlier
    5. Parent - ItemView.RelationshipAccordionTabs
    6. Action - Add
    7. For Identity - Administrators
  9. Save and close this item
  10. 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

Anonymous