<?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 Re: Changing dependent field value using Catalog client script in Developer forum</title>
    <link>https://www.servicenow.com/community/developer-forum/changing-dependent-field-value-using-catalog-client-script/m-p/2756964#M1061656</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/497629"&gt;@vidhya_mouli&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;You don't need any scripting for this. Use the Auto populate option which is on your support group variable.&lt;/P&gt;
&lt;P&gt;Select the dependent question as Application service and on Dot walk path select the Support group.&lt;/P&gt;
&lt;P&gt;Refer below screen.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2023-12-08 at 6.38.14 PM.png" style="width: 627px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/311569iDBDFBB07F04BEDDE/image-dimensions/627x218?v=v2" width="627" height="218" role="button" title="Screenshot 2023-12-08 at 6.38.14 PM.png" alt="Screenshot 2023-12-08 at 6.38.14 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 08 Dec 2023 13:11:37 GMT</pubDate>
    <dc:creator>PavanK960672992</dc:creator>
    <dc:date>2023-12-08T13:11:37Z</dc:date>
    <item>
      <title>Changing dependent field value using Catalog client script</title>
      <link>https://www.servicenow.com/community/developer-forum/changing-dependent-field-value-using-catalog-client-script/m-p/2756930#M1061641</link>
      <description>&lt;P&gt;I have these variables on my catalog item:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="vidhya_mouli_0-1702039452232.png" style="width: 400px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/311563i21FFC3F78DDCD79F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="vidhya_mouli_0-1702039452232.png" alt="vidhya_mouli_0-1702039452232.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;application_service&lt;/STRONG&gt; is on &lt;STRONG&gt;cmdb_ci_service&lt;/STRONG&gt; table.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;support_group&lt;/STRONG&gt; is on &lt;STRONG&gt;sys_user_group&lt;/STRONG&gt; table&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When&amp;nbsp;&lt;STRONG&gt;application_service&lt;/STRONG&gt; changes I want &lt;STRONG&gt;support_group&lt;/STRONG&gt; to change automatically.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is my catalog client script:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        return;
    }

   var supportGroup = ''; 
    var cmdbCiService = new GlideRecord('cmdb_ci_service');
    cmdbCiService.addQuery('sys_id', newValue);
    cmdbCiService.query();

	g_form.addInfoMessage("OUSIDE: "+newValue);
	if (cmdbCiService.next()) {
		supportGroup = cmdbCiService.getValue('support_group');
        g_form.addInfoMessage("Support: " + supportGroup);
    }
	g_form.setValue("variables.support_group", supportGroup);
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am able to fetch the sys_id correctly but not able to set the value. How can I do this?&lt;/P&gt;</description>
      <pubDate>Fri, 08 Dec 2023 12:46:53 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/changing-dependent-field-value-using-catalog-client-script/m-p/2756930#M1061641</guid>
      <dc:creator>vidhya_mouli</dc:creator>
      <dc:date>2023-12-08T12:46:53Z</dc:date>
    </item>
    <item>
      <title>Re: Changing dependent field value using Catalog client script</title>
      <link>https://www.servicenow.com/community/developer-forum/changing-dependent-field-value-using-catalog-client-script/m-p/2756934#M1061643</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/497629"&gt;@vidhya_mouli&lt;/a&gt;&amp;nbsp;Ideally you should never make a GlideRecord query from the client script as it doesn't work on the Service portal. You can use a combination of a GlideAjax in client script and a script include.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since you are testing this script on the backend and managed to get the sys_id. You can apply the following fix to set value on the support_group field.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        return;
    }

   var supportGroup = ''; 
    var cmdbCiService = new GlideRecord('cmdb_ci_service');
    cmdbCiService.addQuery('sys_id', newValue);
    cmdbCiService.query();

	g_form.addInfoMessage("OUSIDE: "+newValue);
	if (cmdbCiService.next()) {
		supportGroup = cmdbCiService.getValue('support_group');
        g_form.addInfoMessage("Support: " + supportGroup);
    }
	g_form.setValue("support_group", supportGroup);
}
&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 08 Dec 2023 12:52:27 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/changing-dependent-field-value-using-catalog-client-script/m-p/2756934#M1061643</guid>
      <dc:creator>Sandeep Rajput</dc:creator>
      <dc:date>2023-12-08T12:52:27Z</dc:date>
    </item>
    <item>
      <title>Re: Changing dependent field value using Catalog client script</title>
      <link>https://www.servicenow.com/community/developer-forum/changing-dependent-field-value-using-catalog-client-script/m-p/2756935#M1061644</link>
      <description>&lt;P&gt;I tried this. But it did not work.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Dec 2023 12:53:38 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/changing-dependent-field-value-using-catalog-client-script/m-p/2756935#M1061644</guid>
      <dc:creator>vidhya_mouli</dc:creator>
      <dc:date>2023-12-08T12:53:38Z</dc:date>
    </item>
    <item>
      <title>Re: Changing dependent field value using Catalog client script</title>
      <link>https://www.servicenow.com/community/developer-forum/changing-dependent-field-value-using-catalog-client-script/m-p/2756951#M1061652</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/497629"&gt;@vidhya_mouli&lt;/a&gt;&amp;nbsp;This can be done without scripting. Open the "Support group" variable and go to "Auto populate" section.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In dependent question, select Application service and "Sys ID" in dot walk path field.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SANDEEP28_0-1702040324109.png" style="width: 749px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/311568i17157131C175F775/image-dimensions/749x219?v=v2" width="749" height="219" role="button" title="SANDEEP28_0-1702040324109.png" alt="SANDEEP28_0-1702040324109.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If I could help you with your Query then, please hit the Thumb Icon and mark as Correct !!&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Dec 2023 13:00:44 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/changing-dependent-field-value-using-catalog-client-script/m-p/2756951#M1061652</guid>
      <dc:creator>SANDEEP28</dc:creator>
      <dc:date>2023-12-08T13:00:44Z</dc:date>
    </item>
    <item>
      <title>Re: Changing dependent field value using Catalog client script</title>
      <link>https://www.servicenow.com/community/developer-forum/changing-dependent-field-value-using-catalog-client-script/m-p/2756964#M1061656</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/497629"&gt;@vidhya_mouli&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;You don't need any scripting for this. Use the Auto populate option which is on your support group variable.&lt;/P&gt;
&lt;P&gt;Select the dependent question as Application service and on Dot walk path select the Support group.&lt;/P&gt;
&lt;P&gt;Refer below screen.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2023-12-08 at 6.38.14 PM.png" style="width: 627px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/311569iDBDFBB07F04BEDDE/image-dimensions/627x218?v=v2" width="627" height="218" role="button" title="Screenshot 2023-12-08 at 6.38.14 PM.png" alt="Screenshot 2023-12-08 at 6.38.14 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Dec 2023 13:11:37 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/changing-dependent-field-value-using-catalog-client-script/m-p/2756964#M1061656</guid>
      <dc:creator>PavanK960672992</dc:creator>
      <dc:date>2023-12-08T13:11:37Z</dc:date>
    </item>
    <item>
      <title>Re: Changing dependent field value using Catalog client script</title>
      <link>https://www.servicenow.com/community/developer-forum/changing-dependent-field-value-using-catalog-client-script/m-p/2757030#M1061665</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/497629"&gt;@vidhya_mouli&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I missed out this question , but proud you accepted the right answer and OOTB.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/266535"&gt;@PavanK960672992&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Dec 2023 14:12:47 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/changing-dependent-field-value-using-catalog-client-script/m-p/2757030#M1061665</guid>
      <dc:creator>Dr Atul G- LNG</dc:creator>
      <dc:date>2023-12-08T14:12:47Z</dc:date>
    </item>
  </channel>
</rss>

