Forum Discussion

ShrutiS's avatar
ShrutiS
Creator I
7 years ago

Restricting Action on Multi select.

Hi All, Is there any way to restrict an action menu on multiselect of the item grid. I found this article https://community.aras.com/en/tech-tip-disable-menu-button-using-cui/ for restricting the built in actions such as "save as" , "lock" etc based on the identity. However I want to be able to disable/hide a custom  action on multi select of the grid. Any idea on how I could acheive this functionality would be of great help . Thanks :)

3 Replies

  • Hello, It's not easily possible to disable this custom action as it doesn't exist as a CUI item. That being said, you can achieve a similar result by prompting the user with an error message if two or more items aren't selected. You can do this by changing the action to an ItemType action. This kind of action is always available from the main grid if you're viewing an ItemType it's attached to. You can then check for the number of selected items in the grid with a code sample like below.
    var selectedItems = window.work.grid.GetSelectedItemIDs();
    if (selectedItems.length < 2) {
    return aras.AlertWarning("This action requires two or more items to be selected");
    }
    // Put actual method logic below here
    Chris
    Christopher Gillis Aras Labs Software Engineer
  • Hi there,

    We've just published a new blog post on creating CUI buttons that are enabled/disabled based on some conditions. The example we used in the blog post was how to ensure that users can only run an action when multiple items are selected in the grid. You can find this blog here: https://community.aras.com/b/english/posts/conditional-cui-buttons

    Hope this helps!

    Chris

    Christopher Gillis

    Aras Labs Software Engineer

    • ShrutiS's avatar
      ShrutiS
      Creator I

      Thankyou...I am sure it will be helpful :)