ARAS 12 - How to remove "Create New XXX" button ?

オフライン

Hi,

I defined an ItemType named "Cost".
This is a relationship without related item.
There is nothing in the "Can Add" of this ItemType because nobody can create a "Cost". There are only created by code.

In ARAS 12, I have this:

What should I do in CUI to remove "Create New Cost" ?

Parents
  • Hi Miraks,

    Gis right, CUI button is generic and it will impact on all item types. 

     Either you can restrict user through permission or on Item type client events (on before new event) you can write javascript method to restrict all users.

    below is the code to restrict all users to create Item from main grid :

    var inn = top.aras;
    if (window.itemID === undefined){
    aras.AlertError("You cannot create Item from the main grid!");
    return false;
    }else{
    return this;
    }

    Regards,

    Suhas

  • 0 オフライン in reply to Suhas

    Hi and ,

    Because, I have nothing in "Can Add" of the ItemType, the button do nothing when I click on it.
    And will never do something, this is why I wanted to remove it.

    But if this is not possible, I will forgot this idea.

  • 0 オフライン in reply to miraks

    Hello, 

    I want to do the same, Is there a way to remove that create button or disable it from UI.
    My use case is I am creating items from the backend code using IOM api and want to restrict Item creation from UI.

    For disabling button I can remove can add from item but in that case I can't create items using IOM api as well.
    Need some way remove or disable create button from UI only.

    Thanks,
    Nilesh

  • 0 オフライン in reply to Nilesh

    Under can add, give access only to user account you are using to create the item in IOM api.(example: Super User).

  • 0 オフライン in reply to Gopikrishnan

    Thanks for reply......

    In IOM api I am using admin user and want to disable create button for the same user, See I don't it is possible by making changes in can add relationship, As I need to add some user in can add to create item using IOM api, but that user can create item from UI right, I want to restrict that.


    Can I do it using any client script?

    Thanks,
    Nilesh

  • 0 オフライン in reply to Nilesh

    Hi Nilesh

    You can create specific identity and add in can Add. Only members of that identity can add the item in UI as well as in IOM method. In your method, you can grant the access to that identity and revoke later.

    Code Snippet below

    In my case, I added ARAS PLM in Can Add - Only members of ARAS PLM can add this item

    Innovator inn = this.getInnovator();

    // Granting Access to ARAS PLM
    Aras.Server.Security.Identity plmIdentity = Aras.Server.Security.Identity.GetByName("Aras PLM");
    bool PermissionWasSet = Aras.Server.Security.Permissions.GrantIdentity(plmIdentity);
    try
    {
    var createItem = inn.newItem("Document", "add");
    createItem.setProperty("name", "TestDocument");
    createItem.setProperty("item_number", "1234");
    createItem= createItem.apply();
    }
    finally
    {
    // Revoke 'Aras PLM' permissions
    if (PermissionWasSet) Aras.Server.Security.Permissions.RevokeIdentity(plmIdentity);
    }
    return this;

    Thank You

    Gopikrishnan R

Reply
  • 0 オフライン in reply to Nilesh

    Hi Nilesh

    You can create specific identity and add in can Add. Only members of that identity can add the item in UI as well as in IOM method. In your method, you can grant the access to that identity and revoke later.

    Code Snippet below

    In my case, I added ARAS PLM in Can Add - Only members of ARAS PLM can add this item

    Innovator inn = this.getInnovator();

    // Granting Access to ARAS PLM
    Aras.Server.Security.Identity plmIdentity = Aras.Server.Security.Identity.GetByName("Aras PLM");
    bool PermissionWasSet = Aras.Server.Security.Permissions.GrantIdentity(plmIdentity);
    try
    {
    var createItem = inn.newItem("Document", "add");
    createItem.setProperty("name", "TestDocument");
    createItem.setProperty("item_number", "1234");
    createItem= createItem.apply();
    }
    finally
    {
    // Revoke 'Aras PLM' permissions
    if (PermissionWasSet) Aras.Server.Security.Permissions.RevokeIdentity(plmIdentity);
    }
    return this;

    Thank You

    Gopikrishnan R

Children