<?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 On click of ui action button the corresponding field is getting disappear in Developer forum</title>
    <link>https://www.servicenow.com/community/developer-forum/on-click-of-ui-action-button-the-corresponding-field-is-getting/m-p/1379249#M36175</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;I am trying to create one button in incident table. Based the button selection one field&amp;nbsp;should&amp;nbsp;be visible and mandatory.&lt;/P&gt;
&lt;P&gt;But if i&amp;nbsp;select the&amp;nbsp; ui action in incident form its working but when i submit&amp;nbsp;the incident the&amp;nbsp;particular field is getting disappear. Not sure how its happening...Any idea will be appreciated..&lt;/P&gt;
&lt;P&gt;This is my ui action condition :&lt;/P&gt;
&lt;P&gt;((current.state !=6) &amp;amp;&amp;amp; (current.u_major_incident == false) &amp;amp;&amp;amp; (gs.hasRole("admin")) || gs.getUser().isMemberOf(­'database') || current.u_major_incident == true)&lt;/P&gt;
&lt;P&gt;Below is the ui action script :&lt;/P&gt;
&lt;P&gt;function testbutton(){&lt;BR /&gt; &lt;BR /&gt;g_form.setVisible('u_incident_manager',true);&lt;BR /&gt; g_form.setMandatory('u_incident_manager', true);&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;And i wrote on onload client script to hide the u_incident manager field on onload.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But somehow its not working ..can someone help me to resolve the issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 29 May 2020 10:45:27 GMT</pubDate>
    <dc:creator>keerthi19</dc:creator>
    <dc:date>2020-05-29T10:45:27Z</dc:date>
    <item>
      <title>On click of ui action button the corresponding field is getting disappear</title>
      <link>https://www.servicenow.com/community/developer-forum/on-click-of-ui-action-button-the-corresponding-field-is-getting/m-p/1379249#M36175</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;I am trying to create one button in incident table. Based the button selection one field&amp;nbsp;should&amp;nbsp;be visible and mandatory.&lt;/P&gt;
&lt;P&gt;But if i&amp;nbsp;select the&amp;nbsp; ui action in incident form its working but when i submit&amp;nbsp;the incident the&amp;nbsp;particular field is getting disappear. Not sure how its happening...Any idea will be appreciated..&lt;/P&gt;
&lt;P&gt;This is my ui action condition :&lt;/P&gt;
&lt;P&gt;((current.state !=6) &amp;amp;&amp;amp; (current.u_major_incident == false) &amp;amp;&amp;amp; (gs.hasRole("admin")) || gs.getUser().isMemberOf(­'database') || current.u_major_incident == true)&lt;/P&gt;
&lt;P&gt;Below is the ui action script :&lt;/P&gt;
&lt;P&gt;function testbutton(){&lt;BR /&gt; &lt;BR /&gt;g_form.setVisible('u_incident_manager',true);&lt;BR /&gt; g_form.setMandatory('u_incident_manager', true);&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;And i wrote on onload client script to hide the u_incident manager field on onload.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But somehow its not working ..can someone help me to resolve the issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 May 2020 10:45:27 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/on-click-of-ui-action-button-the-corresponding-field-is-getting/m-p/1379249#M36175</guid>
      <dc:creator>keerthi19</dc:creator>
      <dc:date>2020-05-29T10:45:27Z</dc:date>
    </item>
    <item>
      <title>Re: On click of ui action button the corresponding field is getting disappear</title>
      <link>https://www.servicenow.com/community/developer-forum/on-click-of-ui-action-button-the-corresponding-field-is-getting/m-p/1379250#M36176</link>
      <description>&lt;P&gt;Hi Keerthi,&lt;/P&gt;
&lt;P&gt;If you've got an onLoad client script that is set to hide the u_incident_manager field, it's always going to hide it. I presume you're wanting the field to be visible onLoad if it is no longer empty, i.e UI action has been previously pressed.&lt;/P&gt;
&lt;PRE class="language-javascript"&gt;&lt;CODE&gt;if(g_form.getValue('u_incident_manager') == ''){
g_form.setVisible('u_incident_manager',false);
}&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P style="text-align: center;"&gt;If my reply helped with your issue please mark helpful &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt; and correct if your issue is now resolved. &lt;span class="lia-unicode-emoji" title=":white_heavy_check_mark:"&gt;✅&lt;/span&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 8pt;"&gt;By doing so you help other community members find resolved questions which may relate to an issue they're having.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 29 May 2020 10:50:56 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/on-click-of-ui-action-button-the-corresponding-field-is-getting/m-p/1379250#M36176</guid>
      <dc:creator>Kieran Anson</dc:creator>
      <dc:date>2020-05-29T10:50:56Z</dc:date>
    </item>
    <item>
      <title>Re: On click of ui action button the corresponding field is getting disappear</title>
      <link>https://www.servicenow.com/community/developer-forum/on-click-of-ui-action-button-the-corresponding-field-is-getting/m-p/1379251#M36177</link>
      <description>&lt;P&gt;Hi Keethi,&lt;/P&gt;
&lt;P&gt;2 things to check&lt;/P&gt;
&lt;P&gt;1) button to be shown when &lt;SPAN class="ng-scope"&gt;u_incident_manager&lt;/SPAN&gt; -&amp;gt; is true&lt;/P&gt;
&lt;P&gt;2) on click of that button the field should be mandatory?&lt;/P&gt;
&lt;P&gt;What are you trying to achieve? please explain?&lt;/P&gt;
&lt;P&gt;Is that a true/false field? if yes then setting mandatory won't work as True and False both are valid values for Boolean field&lt;/P&gt;
&lt;P&gt;Regards&lt;BR /&gt;Ankur&lt;/P&gt;</description>
      <pubDate>Fri, 29 May 2020 11:08:29 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/on-click-of-ui-action-button-the-corresponding-field-is-getting/m-p/1379251#M36177</guid>
      <dc:creator>Ankur Bawiskar</dc:creator>
      <dc:date>2020-05-29T11:08:29Z</dc:date>
    </item>
    <item>
      <title>Re: On click of ui action button the corresponding field is getting disappear</title>
      <link>https://www.servicenow.com/community/developer-forum/on-click-of-ui-action-button-the-corresponding-field-is-getting/m-p/1379252#M36178</link>
      <description>&lt;P&gt;Hi Ankur,&lt;/P&gt;
&lt;P&gt;There are two things here.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="find_real_file.png"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/139150i55A8C6A80EEA40F9/image-size/large?v=v2&amp;amp;px=999" role="button" title="find_real_file.png" alt="find_real_file.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;1. So when i select the "Test Button" the Incident Manager field should be visible and mandatory and it should be visible in&amp;nbsp;the form after submitting the form too.&lt;/P&gt;
&lt;P&gt;2. And When i select the Major incident check box then only the "Test Button" should visible in&amp;nbsp;the form otherwise it wont visible in&amp;nbsp;the form(If it happens onchange of the&amp;nbsp;checkbox&amp;nbsp;then it would be great). Right now it working after submit.&lt;/P&gt;
&lt;P&gt;I am expecting this two points only.. So for this i tried the above mentioned ui action and client script its working to show the field but when i submit the form the incident manager field disappear..Something is overriding i guess but unable to find out..&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To hide onload of the form wrote ui&amp;nbsp;policy without any condition.&lt;/P&gt;
&lt;P&gt;To button visibility wrote the&amp;nbsp;above ui action..&lt;/P&gt;
&lt;P&gt;&amp;nbsp;I hope its clear now...&lt;/P&gt;</description>
      <pubDate>Fri, 29 May 2020 11:18:56 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/on-click-of-ui-action-button-the-corresponding-field-is-getting/m-p/1379252#M36178</guid>
      <dc:creator>keerthi19</dc:creator>
      <dc:date>2020-05-29T11:18:56Z</dc:date>
    </item>
    <item>
      <title>Re: On click of ui action button the corresponding field is getting disappear</title>
      <link>https://www.servicenow.com/community/developer-forum/on-click-of-ui-action-button-the-corresponding-field-is-getting/m-p/1379253#M36179</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I think the issue is with onLoad client script which is hiding&amp;nbsp;u_incident manager field on onload.&lt;/P&gt;
&lt;P&gt;Can you pls share your onload client script or try by adding&amp;nbsp; condition like&amp;nbsp;u_incident manager field is empty.&lt;/P&gt;
&lt;P&gt;then only hide&amp;nbsp;u_incident manager field.&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Pooja M&lt;/P&gt;</description>
      <pubDate>Fri, 29 May 2020 11:32:54 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/on-click-of-ui-action-button-the-corresponding-field-is-getting/m-p/1379253#M36179</guid>
      <dc:creator>Pooja Mallikarj</dc:creator>
      <dc:date>2020-05-29T11:32:54Z</dc:date>
    </item>
    <item>
      <title>Re: On click of ui action button the corresponding field is getting disappear</title>
      <link>https://www.servicenow.com/community/developer-forum/on-click-of-ui-action-button-the-corresponding-field-is-getting/m-p/1379254#M36180</link>
      <description>&lt;P&gt;Yes aready wrote in same way only but not working.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is my script :&lt;/P&gt;
&lt;P&gt;function onLoad() {&lt;BR /&gt; &lt;BR /&gt;if(g_form.getValue('u_incident_manager') == ''){&lt;BR /&gt;g_form.setDisplay('u_incident_manager',false);&lt;BR /&gt;}&lt;BR /&gt; &lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Fri, 29 May 2020 11:37:47 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/on-click-of-ui-action-button-the-corresponding-field-is-getting/m-p/1379254#M36180</guid>
      <dc:creator>keerthi19</dc:creator>
      <dc:date>2020-05-29T11:37:47Z</dc:date>
    </item>
    <item>
      <title>Re: On click of ui action button the corresponding field is getting disappear</title>
      <link>https://www.servicenow.com/community/developer-forum/on-click-of-ui-action-button-the-corresponding-field-is-getting/m-p/1379255#M36181</link>
      <description>&lt;P&gt;Hi Keerthi,&lt;BR /&gt;&lt;BR /&gt;Can you confirm what exactly is not working as expected in your requirement.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;OL&gt;&lt;LI&gt;Your UI action is not working -&amp;gt; Is it visible? Is it showing &lt;STRONG&gt;u_incident_manager&lt;/STRONG&gt; field on the form and making it &lt;STRONG&gt;mandatory&lt;/STRONG&gt; upon clicking UI action?&lt;/LI&gt;&lt;LI&gt;Your Client script is not working -&amp;gt;&amp;nbsp;&lt;STRONG&gt;u_incident_manager &lt;/STRONG&gt;filed is showing on the form even it is &lt;STRONG&gt;empty&lt;/STRONG&gt;?&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;&lt;BR /&gt;I'm assuming it's second case form the above conversation. please enable filed watcher from your developer options and &lt;STRONG&gt;watch&lt;/STRONG&gt; the field &lt;STRONG&gt;u_incident_manager&lt;/STRONG&gt; to find out the issue.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;If it helps, please mark &lt;span class="lia-unicode-emoji" title=":white_heavy_check_mark:"&gt;✅&lt;/span&gt; Correct and &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt; Helpful.&lt;BR /&gt;&lt;BR /&gt;Thanks &amp;amp; Regards,&lt;BR /&gt;Madhav&lt;/P&gt;</description>
      <pubDate>Fri, 29 May 2020 12:19:20 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/on-click-of-ui-action-button-the-corresponding-field-is-getting/m-p/1379255#M36181</guid>
      <dc:creator>Madhav18</dc:creator>
      <dc:date>2020-05-29T12:19:20Z</dc:date>
    </item>
    <item>
      <title>Re: On click of ui action button the corresponding field is getting disappear</title>
      <link>https://www.servicenow.com/community/developer-forum/on-click-of-ui-action-button-the-corresponding-field-is-getting/m-p/1379256#M36182</link>
      <description>&lt;P&gt;Hi Keethi,&lt;/P&gt;
&lt;P&gt;please find response below&lt;/P&gt;
&lt;P&gt;1) incident manager field is a checkbox i.e. boolean with value as True/False&lt;/P&gt;
&lt;P&gt;You cannot make it mandatory since both True and False are valid values&lt;/P&gt;
&lt;P&gt;Mark &lt;span class="lia-unicode-emoji" title=":white_heavy_check_mark:"&gt;✅&lt;/span&gt; Correct if this solves your issue and also mark &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt; Helpful if you find my response worthy based on the impact.&lt;BR /&gt;Thanks&lt;BR /&gt;Ankur&lt;/P&gt;</description>
      <pubDate>Fri, 29 May 2020 15:43:32 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/on-click-of-ui-action-button-the-corresponding-field-is-getting/m-p/1379256#M36182</guid>
      <dc:creator>Ankur Bawiskar</dc:creator>
      <dc:date>2020-05-29T15:43:32Z</dc:date>
    </item>
    <item>
      <title>Re: On click of ui action button the corresponding field is getting disappear</title>
      <link>https://www.servicenow.com/community/developer-forum/on-click-of-ui-action-button-the-corresponding-field-is-getting/m-p/1379257#M36183</link>
      <description>&lt;P&gt;Hi Keerthi,&lt;/P&gt;
&lt;P&gt;Your UI Action Script is not correct, please replace with the below code :&lt;BR /&gt;&lt;BR /&gt;//Below is the ui action script :&lt;BR /&gt;testbutton();&lt;BR /&gt;function testbutton(){&lt;BR /&gt;current.u_incident_manager= 'true'; &lt;BR /&gt; action.setRedirectURL(current);&lt;BR /&gt; current.update();&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If my reply helped with your issue please mark&amp;nbsp;my reply as &lt;span class="lia-unicode-emoji" title=":white_heavy_check_mark:"&gt;✅&lt;/span&gt;Correct &amp;amp; &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;Helpful.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Kind Regards,&lt;BR /&gt;Mohammad Danish&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 May 2020 16:24:43 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/on-click-of-ui-action-button-the-corresponding-field-is-getting/m-p/1379257#M36183</guid>
      <dc:creator>Mohammad Danis1</dc:creator>
      <dc:date>2020-05-29T16:24:43Z</dc:date>
    </item>
    <item>
      <title>Re: On click of ui action button the corresponding field is getting disappear</title>
      <link>https://www.servicenow.com/community/developer-forum/on-click-of-ui-action-button-the-corresponding-field-is-getting/m-p/1379258#M36184</link>
      <description>&lt;P&gt;Hi Keerthi,&lt;/P&gt;
&lt;P style="text-align: left;"&gt;I got your issue, it's with onLoad Client script as "u_incident_manager" field is of type true/false, it&amp;nbsp;will be either True or False, it's never going to be empty or blank ' ' which means the below&amp;nbsp;client script is not going to work:&lt;/P&gt;
&lt;PRE class="ng-scope  language-javascript"&gt;&lt;CODE&gt;if(g_form.getValue('u_incident_manager') == ''){
g_form.setVisible('u_incident_manager',false);
}&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P style="text-align: left;"&gt;Secondly, If you will&amp;nbsp;hide&amp;nbsp;&lt;STRONG&gt;u_incident_manager&lt;/STRONG&gt;&amp;nbsp;with&amp;nbsp;&lt;STRONG&gt;onLoad Client Script when it's False&amp;nbsp;&lt;/STRONG&gt;and then will try to set it visible from UI Action as you'r currently doing, it's always going to &lt;STRONG&gt;HIDE&lt;/STRONG&gt;&amp;nbsp;&lt;STRONG&gt;u_incident_manager field&amp;nbsp;&lt;/STRONG&gt;because&amp;nbsp;as soon as you'll click on the UI Action button, form will load and OnLoad Client script will do its job.&amp;nbsp;&lt;/P&gt;
&lt;P style="text-align: left;"&gt;I have an alternate solution to your problem&amp;nbsp;where&amp;nbsp;I am setting the Incident Manager Value from UI action and hiding it if it's False from Client Script.&lt;/P&gt;
&lt;P style="text-align: left;"&gt;See if it satisfies your requirement :&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="text-align: left;"&gt;Client Script :&amp;nbsp;&lt;/P&gt;
&lt;PRE class="language-javascript"&gt;&lt;CODE&gt;function onLoad() {
	//Hide Incident Manager Field If it's False
	if(g_form.getValue('u_incident_manager') == 'false'){
		g_form.setVisible('u_incident_manager',false);
	}
}&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;UI Action :&lt;/P&gt;
&lt;PRE class="language-javascript"&gt;&lt;CODE&gt;showfield();

function showfield()
{
	gs.addInfoMessage('Incident Manager Should be true');
	current.u_incident_manager= 'true';
	current.update();
	action.setRedirectURL(current);
}&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note : As "u_incident_manager"&amp;nbsp;is a true/false field, setting mandatory won't work&amp;nbsp;because True and False both are valid values for Boolean field.&lt;/P&gt;
&lt;P&gt;Thank you!!&lt;/P&gt;
&lt;P&gt;If my reply helped with your issue please mark&amp;nbsp;it as &lt;span class="lia-unicode-emoji" title=":white_heavy_check_mark:"&gt;✅&lt;/span&gt;Correct &amp;amp; &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;Helpful.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Kind Regards,&lt;BR /&gt;Mohammad Danish&lt;/P&gt;</description>
      <pubDate>Sat, 30 May 2020 10:46:16 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/on-click-of-ui-action-button-the-corresponding-field-is-getting/m-p/1379258#M36184</guid>
      <dc:creator>Mohammad Danis1</dc:creator>
      <dc:date>2020-05-30T10:46:16Z</dc:date>
    </item>
  </channel>
</rss>

