<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.aras.com/community/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>How to disable Item Property Edit</title><link>https://www.aras.com/community/f/getting-started/3714/how-to-disable-item-property-edit</link><description>Hello,

my question is, there&amp;#39;s a property in an ItemType that can be input or edited by certain identity (for example, property &amp;quot;Tester&amp;quot; can only be assigned by a Test manager, but can not be filled by other roles, only viewable to others)
Permission</description><dc:language>ja-JP</dc:language><generator>Telligent Community 12</generator><item><title>RE: How to disable Item Property Edit</title><link>https://www.aras.com/community/thread/1656?ContentTypeID=1</link><pubDate>Tue, 05 Jun 2018 14:06:08 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:cd19ff32-1760-476f-a2c5-cf7752ce45ec</guid><dc:creator>squirrel</dc:creator><description>Thank you for your help. this works. :)&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to disable Item Property Edit</title><link>https://www.aras.com/community/thread/1654?ContentTypeID=1</link><pubDate>Tue, 05 Jun 2018 13:54:36 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:87ad184e-4aa0-43ad-840a-d662007218af</guid><dc:creator>Christopher Gillis</dc:creator><description>Hello,

Text Areas use &lt;strong&gt;&amp;lt;textarea&amp;gt;&lt;/strong&gt; tags for the input field rather than an &lt;strong&gt;&amp;lt;input&amp;gt;&lt;/strong&gt; tag. Try the code below instead.

&lt;code&gt;vField1.getElementsByTagName(&amp;quot;textarea&amp;quot;)[0].setAttribute(&amp;quot;disabled&amp;quot;, &amp;quot;&amp;quot;);&lt;/code&gt;

You can use your browser&amp;#39;s debugging tools (typically launched by pressing F12 on your keyboard) to inspect your input fields and determine which tags you need to disable.

Chris

&lt;hr /&gt;

Christopher Gillis

Aras Labs Software Engineer&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to disable Item Property Edit</title><link>https://www.aras.com/community/thread/1653?ContentTypeID=1</link><pubDate>Tue, 05 Jun 2018 13:46:06 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:6da81fd6-c267-47f3-bf6b-e26471636972</guid><dc:creator>squirrel</dc:creator><description>I meant text area&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to disable Item Property Edit</title><link>https://www.aras.com/community/thread/1652?ContentTypeID=1</link><pubDate>Tue, 05 Jun 2018 13:45:51 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:f571b079-8cb4-41b7-9e4d-e443f5d41325</guid><dc:creator>squirrel</dc:creator><description>Yes, this is a test Area. I am testing the method with one, eventually will have other fields, text and drop downs.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to disable Item Property Edit</title><link>https://www.aras.com/community/thread/1651?ContentTypeID=1</link><pubDate>Tue, 05 Jun 2018 13:21:21 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:8e7b02b6-a9a6-4130-8ca3-2e24680c2808</guid><dc:creator>Christopher Gillis</dc:creator><description>What kind of field is this? Is this a dropdown or a textarea or something else?

Chris

&lt;hr /&gt;

Christopher Gillis

Aras Labs Software Engineer&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to disable Item Property Edit</title><link>https://www.aras.com/community/thread/1650?ContentTypeID=1</link><pubDate>Tue, 05 Jun 2018 12:47:58 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:63547ca6-e242-409d-85a1-f56a56e54f32</guid><dc:creator>squirrel</dc:creator><description>ok, when I add that, I end up with this error &amp;quot; Unable to get property &amp;#39;setAttribute&amp;#39; of undefined or null reference&amp;quot;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to disable Item Property Edit</title><link>https://www.aras.com/community/thread/1647?ContentTypeID=1</link><pubDate>Tue, 05 Jun 2018 10:00:14 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:17ad42f2-21de-46aa-b672-306fceb1cc24</guid><dc:creator>Christopher Gillis</dc:creator><description>Hello,

The element returned by &lt;strong&gt;getFieldByName&lt;/strong&gt; is not the input element for that field. You will need to disable the input by using code like &lt;code&gt;vField1.getElementsByTagName(&amp;quot;input&amp;quot;)[0].setAttribute(&amp;quot;disabled&amp;quot;, &amp;quot;&amp;quot;);&lt;/code&gt;.

Chris

&lt;hr /&gt;

Christopher Gillis

Aras Labs Software Engineer&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to disable Item Property Edit</title><link>https://www.aras.com/community/thread/1642?ContentTypeID=1</link><pubDate>Mon, 04 Jun 2018 19:08:54 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:0a2600cb-61ce-4aa2-a05d-04e7d5fc5866</guid><dc:creator>squirrel</dc:creator><description>Hi Chris, thank you for your help. I used your logic above but it was complaining about something else.
I got this one  to work the way I would like it to. However, it still allows input although it  does not save the result. How can I completely restrict edit/input? 

var contextItem = document.thisItem;
var reqs = contextItem.newItem(&amp;quot;part&amp;quot;, &amp;quot;get&amp;quot;); 
var identity = aras.getIdentityList();
var vField1 = getFieldByName(&amp;quot;part_desc&amp;quot;);
 
if (identity != &amp;quot;DBA5D86402BF43D5976854B8B48FCDD1&amp;quot;); 
    vField1.disabled = true;

    vField1.readOnly = true;
 
 
return;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to disable Item Property Edit</title><link>https://www.aras.com/community/thread/1636?ContentTypeID=1</link><pubDate>Fri, 01 Jun 2018 11:03:26 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:6aa00620-dcc4-49a0-92e6-b114e92a72a5</guid><dc:creator>Christopher Gillis</dc:creator><description>Hello,

There&amp;#39;s a few issues with the code in that example. The specific error message that&amp;#39;s being thrown is saying that the Identity variable you&amp;#39;re checking in the if statement was never defined. The sample below should offer the functionality you&amp;#39;re expecting.

&lt;pre&gt;&lt;code&gt;var identityList = aras.getIdentityList();
if (!identityList.includes(&amp;quot;REPLACE THIS WITH THE ID OF PLM ADMINISTRATOR&amp;quot;))
{
getFieldByName(&amp;quot;name&amp;quot;).getElementsByTagName(&amp;quot;input&amp;quot;)[0].setAttribute(&amp;quot;disabled&amp;quot;, &amp;quot;&amp;quot;); // &amp;lt;-- The disabled attribute does not need a value to take effect.
}
else
{
// We don&amp;#039;t want to do anything in this case. If we enable the field, it will be enabled even the item is locked.
}&lt;/code&gt;&lt;/pre&gt;


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

&lt;hr /&gt;

Christopher Gillis

Aras Labs Software Engineer&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to disable Item Property Edit</title><link>https://www.aras.com/community/thread/1629?ContentTypeID=1</link><pubDate>Thu, 31 May 2018 14:53:47 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:48fe35c2-a820-4ca9-9c6d-1686204e6309</guid><dc:creator>squirrel</dc:creator><description>Hi Christopher,

I following the above example and running this method attached to on From populate but I keep getting an error. I want to disable edit for everyone else except &amp;quot;PLM Aministrator&amp;quot;
******

aras.getIdentityList();

if (Identity != &amp;quot;PLM Administrator&amp;quot;)
    { 
getFieldByName(&amp;quot;dept_discipline&amp;quot;).getElementsByTagName(&amp;quot;input&amp;quot;)[0].setAttribute(&amp;quot;disabled&amp;quot;, &amp;quot;1&amp;quot;); 
    }
else
    { 
    (&amp;quot;disabled&amp;quot;, &amp;quot;0&amp;quot;); 
    }

******

The error I get is &amp;quot;even handler failed with message identity is not defined (function onformpopulated userhandler) 

What am I missing?&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to disable Item Property Edit</title><link>https://www.aras.com/community/thread/1624?ContentTypeID=1</link><pubDate>Thu, 31 May 2018 10:24:18 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:6046989e-8ba7-49d8-aa76-86e96040ed3f</guid><dc:creator>Christopher Gillis</dc:creator><description>Hi chenze,

Yes, the IDs returned are group Identities that the current user is a member of.  Once verifying that the user is not a Test Manager you can disable the field with a line like &lt;code&gt;getFieldByName(&amp;quot;YOUR_FIELD_NAME&amp;quot;).getElementsByTagName(&amp;quot;input&amp;quot;)[0].setAttribute(&amp;quot;disabled&amp;quot;, &amp;quot;&amp;quot;);&lt;/code&gt;.

Chris

&lt;hr /&gt;

Christopher Gillis

Aras Labs Software Engineer&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to disable Item Property Edit</title><link>https://www.aras.com/community/thread/1623?ContentTypeID=1</link><pubDate>Thu, 31 May 2018 03:01:55 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:f4648216-1251-4f1f-a571-fb741a7c46af</guid><dc:creator>chenze</dc:creator><description>Hi Chris,

many thanks for your reply.
According to your suggestion. The first one is not suitable. 
In the second one, if I understand it right, the returned IDs are group identities (e.g. &amp;quot;Test Manager, Developers&amp;quot;) that the currently logged in users belongs to? Again, is there a function to set property &amp;quot;not editable&amp;quot;?

Thank you.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to disable Item Property Edit</title><link>https://www.aras.com/community/thread/1622?ContentTypeID=1</link><pubDate>Wed, 30 May 2018 16:02:55 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:17d357bd-83f5-4ec9-a300-fd890255a0c9</guid><dc:creator>Christopher Gillis</dc:creator><description>Hi Chenze,

There are a few different ways to approach this.
&lt;ol&gt;
 	&lt;li&gt;You could convert this from an Item Property into a Relationship and then configure the permissions of the relationship to allow adding only by a Test manager
&lt;ul&gt;
 	&lt;li&gt;Cons: This does require changing the existing data model and moving data to this new relationship&lt;/li&gt;
 	&lt;li&gt;Pros: This could make sense if an item can have multiple Testers&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
 	&lt;li&gt;Attach on onFormPopulated event to the Form to check if the user is a Test Manager and disable the property if they are not
&lt;ul&gt;
 	&lt;li&gt;You can use &lt;code&gt;aras.getIdentityList();&lt;/code&gt; to get a comma separated list of IDs of the Identities the user belongs to&lt;/li&gt;
 	&lt;li&gt;Pros: No changes to the data model&lt;/li&gt;
 	&lt;li&gt;Cons: Only prevents users from editing the property on that specific form. Users can still edit the property through other means like AML&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
Chris

&lt;hr /&gt;

Christopher Gillis

Aras Labs Software Engineer&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>