“How can I hide a specific relationship tab on one of my forms?”
It’s a fairly common question asked by Aras administrators. You may need to hide a tab when an item is in a certain lifecycle state, has a particular classification, or a user belongs to a specific identity. Below, we will walk through the general approach for hiding relationship tabs, as well as review a couple use case-specific modifications.
You can find all of the code and files for this demonstration on the Aras Labs GitHub page in the hide-tabs project. If you want to install the project and follow along, the project page includes all of the instructions for installing the import package.
hide-tabs – Demonstrates how to hide specific tabs on a tear-off form.
Note: Users on Aras 11 SP9 should download v2.0.1 of the Hide-Tabs project. Aras releases 11 SP8 and earlier should download Hide-Tabs v1.0.
How It Works
Adding the Form Event
- Copy and paste the code from the editor below into the new method.
- Save, unlock, and close the new HideTabs method.
- Open the Part form for editing.
- Under the Form Events tab, add your new HideTabs method as an OnLoad event.
- Save, unlock, and close the Part form.
To confirm that the form event works, navigate to Design > Parts in the table of contents and open any Part for viewing. The first relationship tab should be the Alternates tab, and the BOM and BOM Substitutes tabs should not appear at all.
It’s easy to modify this sample code for many use cases. For example, if you need to hide a specific tab for Parts of a certain classification, you can just add a couple lines of code to check the context item’s classification before calling the hideTabs() function within the form event.
Here are a couple use case-specific modifications of the above method code.
Hide Tabs When Part Is Not an Assembly
Hide Tabs When User Is Not the Creator
Feel free to share your use cases and customizations in the comment section below.