Tech Tip: Disable a Menu Button Using CUI

Tech Tip: Disable a Menu Button Using CUI

In previous blogs posts, we've learned how to add a new button to our menus as well as add new keyboard shortcuts. Both of these lessons are great when we want to allow our users to perform new kinds of actions, but how do we prevent our users from performing actions that are already available. Most of the time this can be accomplished by assigning permissions to an ItemType, but there are cases when we may want to hide the possibility of that functionality completely. Fortunately, the same CUI tools that allow for the creation of new menu items also allow for the management of the standard menu items.

Finding the Menu Action

In this example, we will be disabling the Save As functionality for all of our users who are not members of the Administrators Identity. Just as in our previous blog posts, we will start out by opening the Global Presentation Configuration. This can be done by navigating to Administration > Configuration > Client Presentation and clicking the hyperlink highlighted below.

In the Command Bar Section relationship tab, you'll notice that each section handles the UI in different locations of Aras Innovator. The "Save As" button appears in three different locations in the UI.

  1. Main Window Main Menu
    • The top-most menu that is available from the main grid.
  2. Main Window Toolbar
    • The row of buttons immediately below the Main Menu
  3. Popup Menu for Item Grid
    • The context menu viewable by right-clicking on an item in the main grid

Hiding The Buttons

We'll first cover how to hide the Save As button from the Main Menu, but the steps will be very similar for each location.

  1. Search for the Command Bar Section responsible for this location in the Command Bar Section relationship tab
    • Location - Main Window Main Menu
    • Classification - Data Model
  2. There should be one result from this search. Open it
  3. In the Command Bar Item relationship tab, search for the following
    • Name - *save*as*
    • Note: Depending on the Location, this Command Bar Item may either be a Menu, Button, or Menu Button
  4. Set the value of the For Identity [...] field to Administrators
  5. Save, Unlock, and Close the Command Bar Section

Following those steps, the Save As button the Main Menu should be hidden the next time that a non-administrator user logs in. For the Main Window Toolbar and the Popup Menu, you will simply repeat the same steps as above, but search for the appropriate location in Step 1.

Hiding Buttons for Individual ItemTypes

The changes we made above will hide the Save As buttons on a global scale. What if we only want to prevent certain ItemTypes from being copied with Save As? Let's explore how we would do this for the Part ItemType.

  1. To begin, we'll navigate to Administration > ItemTypes and open the Part ItemType
  2. We'll then navigate to the Client Style relationship tab
  3. Let's open this Client Style
    • Note: If this does not already exist, create a new one
  4. In the Command Bar Section relationship tab here, create a new Command Bar Section
    • Classification - Data Model
    • Name - custom_part_main_menu
    • Location - Main Window Main Menu
    • For Identity [...] - World
  5. Save and open this Command Bar Section
  6. In the Command Bar Item relationship tab, use Pick Related to add a new item
  7. Search for and pick the Menu Button named "com.aras.innovator.cui_default.mwmm_saveAs"
  8. Fill in the following information
    • Action - Remove
    • For Identity [...] - World
      • Note: This change will remove the Menu Button for all users including Administrators
  9. Save, Unlock, and Close this Command Bar Section
  10. Save, Unlock, and Close the Presentation Configuration
  11. Save, Unlock, and Close the Part ItemType

You can follow these steps to remove the Save As option from the toolbar and popup menu as well. You'll only need to change the Location in Step 4 and the name of the button in Step 7. The next time that you login, you'll notice that Save As is available for other ItemTypes but not for Parts.

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.