Hide Relationship Tabs on Aras Forms

“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

  1. Create a new JavaScript method in Aras called “HideTabs”.
  2. Copy and paste the code from the editor below into the new method.
  3. Save, unlock, and close the new HideTabs method.
  4. Open the Part form for editing.
  5. Under the Form Events tab, add your new HideTabs method as an OnLoad event.
  6. 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.


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.

Leave a Reply