<?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: How do I dynamically update Service Catalog reference fields based on a selection in another reference field? in Developer forum</title>
    <link>https://www.servicenow.com/community/developer-forum/how-do-i-dynamically-update-service-catalog-reference-fields/m-p/1588756#M245682</link>
    <description>&lt;P&gt;This is a clear case of executing server side data from client side where you have to pull the user's info from the sys_user table as soon as the employee name is entered in the first reference field.&lt;/P&gt;
&lt;P&gt;Instead of the on change client script, please use GlideAjax which passes parameters to the script includes, and, using naming conventions, allows the use of these parameters.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The below docs article from ServiceNow should be helpful.&lt;/P&gt;
&lt;P&gt;https://docs.servicenow.com/en-US/bundle/tokyo-application-development/page/script/ajax/topic/p_AJAX.html&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please mark my answer correct/helpful if it helped you in any way. Thanks&lt;/P&gt;</description>
    <pubDate>Fri, 26 Aug 2022 20:18:45 GMT</pubDate>
    <dc:creator>Saurabh S</dc:creator>
    <dc:date>2022-08-26T20:18:45Z</dc:date>
    <item>
      <title>How do I dynamically update Service Catalog reference fields based on a selection in another reference field?</title>
      <link>https://www.servicenow.com/community/developer-forum/how-do-i-dynamically-update-service-catalog-reference-fields/m-p/1588755#M245681</link>
      <description>&lt;P&gt;On the below request form from our service catalog, I would like the group of text boxes / reference fields to auto-fill based on the user data from the first reference field. I have been seeking an onChange Catalog Client Script / Script Include to get this done, but have had no success. Any help is appreciated.&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/188474i14FBF401A1B31747/image-size/large?v=v2&amp;amp;px=999" srcset="/community/image/serverpage/image-id/188474i14FBF401A1B31747/image-size/large?v=v2&amp;amp;px=999 1.0x" role="button" title="find_real_file.png" alt="find_real_file.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Aug 2022 20:04:51 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-do-i-dynamically-update-service-catalog-reference-fields/m-p/1588755#M245681</guid>
      <dc:creator>Evan McElfresh</dc:creator>
      <dc:date>2022-08-26T20:04:51Z</dc:date>
    </item>
    <item>
      <title>Re: How do I dynamically update Service Catalog reference fields based on a selection in another reference field?</title>
      <link>https://www.servicenow.com/community/developer-forum/how-do-i-dynamically-update-service-catalog-reference-fields/m-p/1588756#M245682</link>
      <description>&lt;P&gt;This is a clear case of executing server side data from client side where you have to pull the user's info from the sys_user table as soon as the employee name is entered in the first reference field.&lt;/P&gt;
&lt;P&gt;Instead of the on change client script, please use GlideAjax which passes parameters to the script includes, and, using naming conventions, allows the use of these parameters.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The below docs article from ServiceNow should be helpful.&lt;/P&gt;
&lt;P&gt;https://docs.servicenow.com/en-US/bundle/tokyo-application-development/page/script/ajax/topic/p_AJAX.html&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please mark my answer correct/helpful if it helped you in any way. Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 26 Aug 2022 20:18:45 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-do-i-dynamically-update-service-catalog-reference-fields/m-p/1588756#M245682</guid>
      <dc:creator>Saurabh S</dc:creator>
      <dc:date>2022-08-26T20:18:45Z</dc:date>
    </item>
    <item>
      <title>Re: How do I dynamically update Service Catalog reference fields based on a selection in another reference field?</title>
      <link>https://www.servicenow.com/community/developer-forum/how-do-i-dynamically-update-service-catalog-reference-fields/m-p/1588757#M245683</link>
      <description>&lt;P&gt;Thank you. This got me closer, but I'm still not quite to my requirement yet. I now am able to populate data into the form automatically, but there's two problems, with screenshots below.&lt;/P&gt;
&lt;P&gt;1) The user info being populated is the logged in user. The template I worked from was built to accomplish this, so I'm not shocked there, but I can't find a solution to instead have the reference be from my Reference Field, "employee_to_be_terminated"&lt;/P&gt;
&lt;P&gt;2) I am getting data onLoad, but it should only be onChange&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Script Include:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&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/188469iB6CC989A2B08D883/image-size/large?v=v2&amp;amp;px=999" srcset="/community/image/serverpage/image-id/188469iB6CC989A2B08D883/image-size/large?v=v2&amp;amp;px=999 1.0x" role="button" title="find_real_file.png" alt="find_real_file.png" /&gt;&lt;/span&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Catalog Client Script&lt;/STRONG&gt;&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/188478i4D09ED39415E9E2A/image-size/large?v=v2&amp;amp;px=999" srcset="/community/image/serverpage/image-id/188478i4D09ED39415E9E2A/image-size/large?v=v2&amp;amp;px=999 1.0x" role="button" title="find_real_file.png" alt="find_real_file.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Aug 2022 16:19:39 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-do-i-dynamically-update-service-catalog-reference-fields/m-p/1588757#M245683</guid>
      <dc:creator>Evan McElfresh</dc:creator>
      <dc:date>2022-08-29T16:19:39Z</dc:date>
    </item>
    <item>
      <title>Re: How do I dynamically update Service Catalog reference fields based on a selection in another reference field?</title>
      <link>https://www.servicenow.com/community/developer-forum/how-do-i-dynamically-update-service-catalog-reference-fields/m-p/1588758#M245684</link>
      <description>&lt;P&gt;I figured it out!&lt;/P&gt;
&lt;P&gt;The key was this small bit of code, which passes the, "newValue" variable to the sysparm_state variable.&lt;/P&gt;
&lt;PRE class="language-markup"&gt;&lt;CODE&gt;function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        return;
    }
    var ga = new GlideAjax("ASHNUserDetailsUtil");
    ga.addParam("sysparm_name", "user_info");
    ga.addParam("sysparm_state", newValue);
    ga.getXML(ajaxResponse);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Catalog Client Script&lt;/STRONG&gt;&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/188471i3A5EE378AF4E9E2C/image-size/large?v=v2&amp;amp;px=999" srcset="/community/image/serverpage/image-id/188471i3A5EE378AF4E9E2C/image-size/large?v=v2&amp;amp;px=999 1.0x" role="button" title="find_real_file.png" alt="find_real_file.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Script Inlucde: Client callable&lt;/STRONG&gt;&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/188472iC8960F6A1B32F9C6/image-size/large?v=v2&amp;amp;px=999" srcset="/community/image/serverpage/image-id/188472iC8960F6A1B32F9C6/image-size/large?v=v2&amp;amp;px=999 1.0x" role="button" title="find_real_file.png" alt="find_real_file.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Aug 2022 15:35:06 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-do-i-dynamically-update-service-catalog-reference-fields/m-p/1588758#M245684</guid>
      <dc:creator>Evan McElfresh</dc:creator>
      <dc:date>2022-08-30T15:35:06Z</dc:date>
    </item>
  </channel>
</rss>

