<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Making a field read only for user with role using UI policy in Developer forum</title>
    <link>https://www.servicenow.com/community/developer-forum/making-a-field-read-only-for-user-with-role-using-ui-policy/m-p/1544380#M201306</link>
    <description>&lt;P&gt;I'm trying to make a field read only for a user with a specific role.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the script associated with the UI Policy I have&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;function onCondition() {&lt;/P&gt;&lt;P&gt;gs.hasRole(x_9004_invoice_que.mgr);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We only have one user with this role however it is making the field read only for all users&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Appreciate any assistance with this&lt;/P&gt;</description>
    <pubDate>Wed, 08 Nov 2017 13:19:32 GMT</pubDate>
    <dc:creator>amacqueen</dc:creator>
    <dc:date>2017-11-08T13:19:32Z</dc:date>
    <item>
      <title>Making a field read only for user with role using UI policy</title>
      <link>https://www.servicenow.com/community/developer-forum/making-a-field-read-only-for-user-with-role-using-ui-policy/m-p/1544380#M201306</link>
      <description>&lt;P&gt;I'm trying to make a field read only for a user with a specific role.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the script associated with the UI Policy I have&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;function onCondition() {&lt;/P&gt;&lt;P&gt;gs.hasRole(x_9004_invoice_que.mgr);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We only have one user with this role however it is making the field read only for all users&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Appreciate any assistance with this&lt;/P&gt;</description>
      <pubDate>Wed, 08 Nov 2017 13:19:32 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/making-a-field-read-only-for-user-with-role-using-ui-policy/m-p/1544380#M201306</guid>
      <dc:creator>amacqueen</dc:creator>
      <dc:date>2017-11-08T13:19:32Z</dc:date>
    </item>
    <item>
      <title>Re: Making a field read only for user with role using UI policy</title>
      <link>https://www.servicenow.com/community/developer-forum/making-a-field-read-only-for-user-with-role-using-ui-policy/m-p/1544381#M201307</link>
      <description>&lt;P&gt;Create a ACL to make the field readonly. It also restricts list view.&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 08 Nov 2017 13:25:05 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/making-a-field-read-only-for-user-with-role-using-ui-policy/m-p/1544381#M201307</guid>
      <dc:creator>Harish KM</dc:creator>
      <dc:date>2017-11-08T13:25:05Z</dc:date>
    </item>
    <item>
      <title>Re: Making a field read only for user with role using UI policy</title>
      <link>https://www.servicenow.com/community/developer-forum/making-a-field-read-only-for-user-with-role-using-ui-policy/m-p/1544382#M201308</link>
      <description>&lt;P&gt;Hello Angus,&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;is not a best practice but why u don't do a cliente script that with a if condition on role set fiel read only :&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;if(gs.hasRole(x_9004_invoice_que.mgr)==true){ g_form.setReadOnly(fieldName, true)};&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Sergio&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Hit Correct , Helpful etcetc...&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 08 Nov 2017 13:25:53 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/making-a-field-read-only-for-user-with-role-using-ui-policy/m-p/1544382#M201308</guid>
      <dc:creator>sergiodecristo1</dc:creator>
      <dc:date>2017-11-08T13:25:53Z</dc:date>
    </item>
    <item>
      <title>Re: Making a field read only for user with role using UI policy</title>
      <link>https://www.servicenow.com/community/developer-forum/making-a-field-read-only-for-user-with-role-using-ui-policy/m-p/1544383#M201309</link>
      <description>&lt;P&gt;Hi Agnus,&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;You can try with below script&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;if(g_user.hasRole('x_9004_invoice_que.mgr')){&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;g_form.setReadOnly('field_name',true);&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;}&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Please mark correct/helpful based on the impact of the response.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Gaurav&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 08 Nov 2017 13:26:52 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/making-a-field-read-only-for-user-with-role-using-ui-policy/m-p/1544383#M201309</guid>
      <dc:creator>Gaurav Bajaj</dc:creator>
      <dc:date>2017-11-08T13:26:52Z</dc:date>
    </item>
    <item>
      <title>Re: Making a field read only for user with role using UI policy</title>
      <link>https://www.servicenow.com/community/developer-forum/making-a-field-read-only-for-user-with-role-using-ui-policy/m-p/1544384#M201310</link>
      <description>&lt;P&gt;HI Angus,&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;You can achive this fucntinality using 3 ways &lt;/P&gt;&lt;BR /&gt;&lt;P&gt;1) ACL - Highly recommended&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;2) Client script &lt;/P&gt;&lt;BR /&gt;&lt;P&gt;3) Ui policy&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;1) ACL:&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Check the below link&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;A title="restricting access to certain fields on a form" __default_attr="182686" __jive_macro_name="thread" class="jive_macro_thread jive_macro" data-orig-content="restricting access to certain fields on a form" data-renderedposition="199_8_288_16" href="https://www.servicenow.com/community?id=community_question&amp;amp;sys_id=07dacb6ddb5cdbc01dcaf3231f9619a4"&gt;restricting access to certain fields on a form&lt;/A&gt; &lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;2) Client script&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: arial, sans-serif; color: #666666;"&gt;&lt;SPAN class="kw2" style="font-weight: bold; font-style: inherit; font-family: inherit; color: #003366;"&gt;function&lt;/SPAN&gt; &lt;SPAN class="kw3" style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #000066;"&gt;onLoad&lt;/SPAN&gt;&lt;SPAN class="br0" style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #009900;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="br0" style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #009900;"&gt;)&lt;/SPAN&gt; &lt;SPAN class="br0" style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #009900;"&gt;{&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: arial, sans-serif; color: #666666;"&gt; &amp;nbsp; &lt;SPAN class="kw2" style="font-weight: bold; font-style: inherit; font-family: inherit; color: #003366;"&gt;var&lt;/SPAN&gt; isXYZUser &lt;SPAN class="sy0" style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #339933;"&gt;=&lt;/SPAN&gt; g_user.&lt;SPAN class="me1" style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #660066;"&gt;hasRole&lt;/SPAN&gt;&lt;SPAN class="br0" style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #009900;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="st0" style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #3366cc;"&gt;'&lt;SPAN style="color: #666666; font-family: arial, sans-serif;"&gt;x_9004_invoice_que.mgr)&lt;/SPAN&gt;'&lt;/SPAN&gt;&lt;SPAN class="br0" style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #009900;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="sy0" style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #339933;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: arial, sans-serif; color: #666666;"&gt; &amp;nbsp; &lt;SPAN class="kw1" style="font-weight: bold; font-style: inherit; font-family: inherit; color: #000066;"&gt;if&lt;/SPAN&gt; &lt;SPAN class="br0" style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #009900;"&gt;(&lt;/SPAN&gt;i&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 13.3333px; font-family: inherit;"&gt;sXYZUser&lt;/SPAN&gt;&lt;SPAN class="br0" style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #009900;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="br0" style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #009900;"&gt;{&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: arial, sans-serif; color: #666666;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; g_form.&lt;SPAN class="me1" style="font-weight: inherit; font-style: inherit; font-size: 13.3333px; font-family: inherit; color: #660066;"&gt;setReadonly&lt;/SPAN&gt;&lt;SPAN class="br0" style="font-weight: inherit; font-style: inherit; font-size: 13.3333px; font-family: inherit; color: #009900;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="st0" style="font-weight: inherit; font-style: inherit; font-size: 13.3333px; font-family: inherit; color: #3366cc;"&gt;'request_date'&lt;/SPAN&gt;&lt;SPAN class="sy0" style="font-weight: inherit; font-style: inherit; font-size: 13.3333px; font-family: inherit; color: #339933;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="kw2" style="font-weight: bold; font-style: inherit; font-size: 13.3333px; font-family: inherit; color: #003366;"&gt;true&lt;/SPAN&gt;&lt;SPAN class="br0" style="font-weight: inherit; font-style: inherit; font-size: 13.3333px; font-family: inherit; color: #009900;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="sy0" style="font-weight: inherit; font-style: inherit; font-size: 13.3333px; font-family: inherit; color: #339933;"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: arial, sans-serif; color: #666666;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 10pt; font-family: inherit;"&gt;&lt;SPAN class="sy0" style="font-weight: inherit; font-style: inherit; font-size: 13.3333px; font-family: inherit; color: #339933;"&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //Similarly make all the required fields read only&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: arial, sans-serif; color: #666666;"&gt; &amp;nbsp; &lt;SPAN class="br0" style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #009900;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: arial, sans-serif; color: #666666;"&gt;&lt;SPAN class="br0" style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #009900;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: arial, sans-serif; color: #666666;"&gt;&lt;SPAN class="br0" style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #009900;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-size: 13.3333px; font-family: arial, sans-serif; color: #666666;"&gt;&lt;SPAN class="kw2" style="font-weight: bold; font-style: inherit; font-size: 13.3333px; font-family: inherit; color: #003366;"&gt;function&lt;/SPAN&gt; &lt;SPAN class="kw3" style="font-weight: inherit; font-style: inherit; font-size: 13.3333px; font-family: inherit; color: #000066;"&gt;onCellEdit&lt;/SPAN&gt;&lt;SPAN class="br0" style="font-weight: inherit; font-style: inherit; font-size: 13.3333px; font-family: inherit; color: #009900;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="br0" style="font-weight: inherit; font-style: inherit; font-size: 13.3333px; font-family: inherit; color: #009900;"&gt;)&lt;/SPAN&gt; &lt;SPAN class="br0" style="font-weight: inherit; font-style: inherit; font-size: 13.3333px; font-family: inherit; color: #009900;"&gt;{&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-size: 13.3333px; font-family: arial, sans-serif; color: #666666;"&gt;&lt;SPAN class="br0" style="font-weight: inherit; font-style: inherit; font-size: 13.3333px; font-family: inherit; color: #009900;"&gt;Implement the above kind of logic here to handle the list view locking&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: arial, sans-serif; color: #666666;"&gt;&lt;SPAN class="br0" style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #009900;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;UI Plocliy&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;SPAN class="kw2" style="font-weight: bold; font-style: inherit; font-family: inherit; color: #003366;"&gt;In 'Execute if true'-&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: arial, sans-serif; color: #666666;"&gt;&lt;SPAN class="kw2" style="font-weight: bold; font-style: inherit; font-family: inherit; color: #003366;"&gt;var&lt;/SPAN&gt; isAdmin &lt;SPAN class="sy0" style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #339933;"&gt;=&lt;/SPAN&gt; g_user.&lt;SPAN class="me1" style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #660066;"&gt;hasRole&lt;/SPAN&gt;&lt;SPAN class="br0" style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #009900;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="st0" style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #3366cc;"&gt;'&lt;SPAN style="color: #666666; font-family: arial, sans-serif;"&gt;x_9004_invoice_que.mgr&lt;/SPAN&gt;'&lt;/SPAN&gt;&lt;SPAN class="br0" style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #009900;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="sy0" style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #339933;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: arial, sans-serif; color: #666666;"&gt;&lt;SPAN class="sy0" style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #339933;"&gt;if(&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 13.3333px; font-family: inherit;"&gt;isAdmin&lt;/SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: arial, sans-serif; color: #666666;"&gt;&lt;SPAN class="sy0" style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #339933;"&gt;{&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: arial, sans-serif; color: #666666;"&gt;&lt;SPAN class="sy0" style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #339933;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: #000000;"&gt;g_form.setReadOnly('fields1', &lt;/SPAN&gt;&lt;SPAN class="keyword" style="font-weight: inherit; font-style: inherit; font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: #006699;"&gt;true&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: #000000;"&gt;);&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: arial, sans-serif; color: #666666;"&gt;&lt;SPAN class="sy0" style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #339933;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: arial, sans-serif; color: #666666;"&gt;&lt;SPAN style="font-weight: bold; font-style: inherit; font-size: 13.3333px; font-family: inherit; color: #003366;"&gt;In 'Execute if false'-&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-size: 13.3333px; font-family: arial, sans-serif; color: #666666;"&gt;&lt;SPAN class="sy0" style="font-weight: inherit; font-style: inherit; font-size: 13.3333px; font-family: inherit;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: #000000;"&gt;g_form.setReadOnly('fields1', &lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: #006699;"&gt;false&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; color: #000000;"&gt;);&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-size: 13.3333px; font-family: arial, sans-serif; color: #666666;"&gt;&lt;SPAN style="color: #000000; font-weight: inherit; font-size: 12px; font-family: Consolas, 'Courier New', Courier, mono, serif; font-style: inherit;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-size: 13.3333px; font-family: arial, sans-serif; color: #666666;"&gt;&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 08 Nov 2017 13:41:03 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/making-a-field-read-only-for-user-with-role-using-ui-policy/m-p/1544384#M201310</guid>
      <dc:creator>Chandu Telu</dc:creator>
      <dc:date>2017-11-08T13:41:03Z</dc:date>
    </item>
    <item>
      <title>Re: Making a field read only for user with role using UI policy</title>
      <link>https://www.servicenow.com/community/developer-forum/making-a-field-read-only-for-user-with-role-using-ui-policy/m-p/1544385#M201311</link>
      <description>&lt;P&gt;Was hoping to make it a bit simpler but that was the right answer.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Many thanks&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 09 Nov 2017 09:31:16 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/making-a-field-read-only-for-user-with-role-using-ui-policy/m-p/1544385#M201311</guid>
      <dc:creator>amacqueen</dc:creator>
      <dc:date>2017-11-09T09:31:16Z</dc:date>
    </item>
  </channel>
</rss>

