"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.
Getting Started
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.
ArasLabs/hide-tabs
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
]
BOM and BOM Substitute tabs hidden in Aras SP9
This project demonstrates how to hide the BOM and BOM Structure tabs on the standard Aras Part form. We add an OnLoad form event to the Part form, which contains the custom JavaScript functions and logic for hiding the specified relationship tabs. In the form event's main function, hideTabs(), we first check to confirm that the relationship grid has been loaded. Once the grid is loaded, we use the form's relTabbar object to explicitly select the Alternates tab and hide the BOM and BOM Substitutes tabs.
Adding the Form Event
- Create a new JavaScript method in Aras called "HideTabs".
- 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.
gist.github.com/…/521dea1dc20a069c13ba356f4142283f
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
gist.github.com/…/3fae580715c9fff6aa4834cbfd574be2
Hide Tabs When User Is Not the Creator
gist.github.com/…/2262844fa30cb3b2bf201c3034e5afd2
Feel free to share your use cases and customizations in the comment section below.
LOOKING FOR MORE ARAS INSPIRATION?
Subscribe to our blog and follow @ArasLabs on Twitter for more helpful content! You can also find our latest open-source projects and sample code on the Aras Labs GitHub page.