How to disable Item Property Edit

オフライン
Hello, my question is, there's a property in an ItemType that can be input or edited by certain identity (for example, property "Tester" can only be assigned by a Test manager, but can not be filled by other roles, only viewable to others) Permission settings is feasible only for ItemType as whole, how should I do configuration for certain item properties? Thank you for the reply. Regards
Parents
  • Hello, There's a few issues with the code in that example. The specific error message that's being thrown is saying that the Identity variable you're checking in the if statement was never defined. The sample below should offer the functionality you're expecting.
    var identityList = aras.getIdentityList();
    if (!identityList.includes("REPLACE THIS WITH THE ID OF PLM ADMINISTRATOR"))
    {
    getFieldByName("name").getElementsByTagName("input")[0].setAttribute("disabled", ""); // <-- The disabled attribute does not need a value to take effect.
    }
    else
    {
    // We don't want to do anything in this case. If we enable the field, it will be enabled even the item is locked.
    }
    You will need to update the line in the If statement to include the ID of the PLM Administrator Identity in your environment. You can find this ID by right-clicking on the item and selecting Properties. You can then click the Copy ID button to get the ID. Chris
    Christopher Gillis Aras Labs Software Engineer
Reply
  • Hello, There's a few issues with the code in that example. The specific error message that's being thrown is saying that the Identity variable you're checking in the if statement was never defined. The sample below should offer the functionality you're expecting.
    var identityList = aras.getIdentityList();
    if (!identityList.includes("REPLACE THIS WITH THE ID OF PLM ADMINISTRATOR"))
    {
    getFieldByName("name").getElementsByTagName("input")[0].setAttribute("disabled", ""); // <-- The disabled attribute does not need a value to take effect.
    }
    else
    {
    // We don't want to do anything in this case. If we enable the field, it will be enabled even the item is locked.
    }
    You will need to update the line in the If statement to include the ID of the PLM Administrator Identity in your environment. You can find this ID by right-clicking on the item and selecting Properties. You can then click the Copy ID button to get the ID. Chris
    Christopher Gillis Aras Labs Software Engineer
Children
No Data