<?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: g_form.addOption() not rendering choices on field switch — ServiceNow Client Script Issue in Developer forum</title>
    <link>https://www.servicenow.com/community/developer-forum/g-form-addoption-not-rendering-choices-on-field-switch/m-p/3560407#M1258042</link>
    <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/880605"&gt;@harshal001&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;H3&gt;&lt;STRONG&gt;Script Include (Client Callable)&lt;/STRONG&gt;&lt;/H3&gt;&lt;LI-CODE lang="markup"&gt;var NCS_FaultCategoryAjax = Class.create();
NCS_FaultCategoryAjax.prototype = Object.extendsObject(AbstractAjaxProcessor, {
   getFaultCategoriesByOpsCategory: function() {
       var opsCategory = this.getParameter('sysparm_ops_category');
       var categoryMapping = {
           fault: [
               {
                   label: 'Hardware Replacement',
                   value: 'hardware_replacement'
               },

               {

                   label: 'Software Fault Remediation',
                   value: 'software_fault_remediation'

               },

               {

                   label: 'Non Hardware Fault - Troubleshooting',

                   value: 'troubleshooting'

               },

               {

                   label: 'Call Management - Hardware Replacement',

                   value: 'call_management_hardware_replacement'

               },

               {

                   label: 'Call Management - Software Remediation',

                   value: 'call_management_software_remediation'

               },

               {

                   label: 'Call Management - UPS Hardware Replacement',

                   value: 'call_management_ups_hardware_replacement'

               }

           ],



           service_request: [

               {

                   label: 'Call Management - UPS',

                   value: 'call_management_ups'

               },

               {

                   label: 'Call Management - Service Request',

                   value: 'call_management_service_request'

               },

               {

                   label: 'Standby Request',

                   value: 'standby_request'

               },

               {

                   label: 'Vulnerability Check Only',

                   value: 'vulnerability_check_only'

               },

               {

                   label: 'Preventive Maintenance Service',

                   value: 'preventive_maintenance_service'

               },

               {

                   label: 'Upgrade/Patch Services',

                   value: 'upgrade_patch_services'

               },

               {

                   label: 'License or Software Download Request',

                   value: 'license_software_download_request'

               },

               {

                   label: 'Configuration Assistance',

                   value: 'configuration_assistance'

               }

           ],
           inquiry: [

               {

                   label: 'Inquiry',

                   value: 'inquiry'

               },

               {

                   label: 'No MA Coverage',

                   value: 'no_ma_coverage'

               }

           ],



           adhoc_request: [

               {

                   label: 'Hardware Replacement',

                   value: 'hardware_replacement'

               },

               {

                   label: 'Software Fault Remediation',

                   value: 'software_fault_remediation'

               },

               {

                   label: 'Non Hardware Fault - Troubleshooting',

                   value: 'troubleshooting'

               },

               {

                   label: 'Call Management - Hardware Replacement',

                   value: 'call_management_hardware_replacement'

               },

               {

                   label: 'Call Management - Software Remediation',

                   value: 'call_management_software_remediation'
               },

               {

                   label: 'Call Management - UPS Hardware Replacement',
                   value: 'call_management_ups_hardware_replacement'

               }

           ]

       };

       return JSON.stringify(categoryMapping[opsCategory] || []);

   },

   type: 'NCS_FaultCategoryAjax'

});&lt;/LI-CODE&gt;&lt;H3&gt;&lt;STRONG&gt;Client Script (onChange on (&lt;/STRONG&gt;&lt;STRONG&gt;u_operations_category&lt;/STRONG&gt;&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/H3&gt;&lt;LI-CODE lang="markup"&gt;function onChange(control, oldValue, newValue, isLoading) {
   if (isLoading || oldValue == newValue)
       return;
   var field = 'u_fault_category';
   // Reset field
   g_form.setValue(field, '');
   g_form.clearOptions(field);
   g_form.addOption(field, '', '-- None --', 0);
   if (!newValue)
       return;
   var selectedCategory = newValue;
   var ga = new GlideAjax('NCS_FaultCategoryAjax');
   ga.addParam('sysparm_name', 'getFaultCategoriesByOpsCategory');
   ga.addParam('sysparm_ops_category', selectedCategory);
   ga.getXMLAnswer(function(answer) {
       // Ignore old AJAX responses
       if (g_form.getValue('u_operations_category') != selectedCategory)
           return;
       if (!answer)
           return;
       var choices = JSON.parse(answer);
       g_form.clearOptions(field);
       g_form.addOption(field, '', '-- None --', 0);
       for (var i = 0; i &amp;lt; choices.length; i++) {
           g_form.addOption(
               field,
               choices[i].value,
               choices[i].label
           );
       }
       g_form.setValue(field, '');
   });
}


&lt;/LI-CODE&gt;&lt;P&gt;&lt;STRONG&gt;*********************************************************************************************************&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If this response helps, please mark it as Accept as Solution and Helpful.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Doing so helps others in the community and encourages me to keep contributing.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Regards&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Vaishali Singh&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Servicenow Developer &lt;/STRONG&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;STRONG&gt;Linkedin - &lt;/STRONG&gt;&lt;A href="https://www.linkedin.com/in/vaishali-singh-2273361bb" target="_blank"&gt;&lt;STRONG&gt;https://www.linkedin.com/in/vaishali-singh-2273361bb&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 17 Jun 2026 07:43:39 GMT</pubDate>
    <dc:creator>vaishali231</dc:creator>
    <dc:date>2026-06-17T07:43:39Z</dc:date>
    <item>
      <title>g_form.addOption() not rendering choices on field switch — ServiceNow Client Script Issue</title>
      <link>https://www.servicenow.com/community/developer-forum/g-form-addoption-not-rendering-choices-on-field-switch/m-p/3560346#M1258029</link>
      <description>&lt;H4&gt;&lt;STRONG&gt;Problem Statement&lt;/STRONG&gt;&lt;/H4&gt;&lt;P class=""&gt;I have a dependent dropdown where selecting an &lt;STRONG&gt;Operations Category&lt;/STRONG&gt; dynamically loads filtered &lt;STRONG&gt;Fault Category&lt;/STRONG&gt; choices via GlideAjax and g_form.addOption().&lt;/P&gt;&lt;P class=""&gt;&lt;STRONG&gt;Issue:&lt;/STRONG&gt; When I select an Operations Category for the &lt;STRONG&gt;first time&lt;/STRONG&gt;, choices load correctly. But when I &lt;STRONG&gt;switch&lt;/STRONG&gt; to a different Operations Category, the Fault Category dropdown shows blank/-- None -- without a page reload.&lt;BR /&gt;&lt;BR /&gt;Script Include:-&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;var NCS_FaultCategoryAjax = Class.create();&lt;BR /&gt;NCS_FaultCategoryAjax.prototype = Object.extendsObject(AbstractAjaxProcessor, {&lt;/P&gt;&lt;P&gt;getFaultCategoriesByOpsCategory: function() {&lt;BR /&gt;var opsCategory = this.getParameter('sysparm_ops_category');&lt;/P&gt;&lt;P&gt;var categoryMapping = {&lt;BR /&gt;'fault': [&lt;BR /&gt;{ label: 'Hardware Replacement', value: 'hardware_replacement' },&lt;BR /&gt;{ label: 'Software Fault Remediation', value: 'Software Fault Remediation' },&lt;BR /&gt;{ label: 'Non Hardware Fault - Troubleshooting', value: 'troubleshooting' }&lt;BR /&gt;],&lt;BR /&gt;'service_request': [&lt;BR /&gt;{ label: 'Call Management - Hardware Replacement', value: 'call_management_Hardware_Replacement' },&lt;BR /&gt;{ label: 'Call Management - Software Remediation', value: 'call_management_Others' },&lt;BR /&gt;{ label: 'Call Management - UPS Hardware Replacement', value: 'call_management_UPS_Hardware_Replacement' },&lt;BR /&gt;{ label: 'Call Management - Fans &amp;amp; Cable Replacement', value: 'call_management_Fans_Cable_Replacement' },&lt;BR /&gt;{ label: 'Call Management - UPS', value: 'call_management_ups' },&lt;BR /&gt;{ label: 'Call Management - Service Request', value: 'call_management_Service_Request' }&lt;BR /&gt;]&lt;BR /&gt;// ... more mappings&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;var result = categoryMapping[opsCategory] || [];&lt;BR /&gt;return JSON.stringify(result);&lt;BR /&gt;},&lt;/P&gt;&lt;P&gt;type: 'NCS_FaultCategoryAjax'&lt;BR /&gt;});&lt;BR /&gt;&lt;BR /&gt;Client Script:- onChange when u_operations_category&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;function onChange(control, oldValue, newValue, isLoading) {&lt;/P&gt;&lt;P&gt;if (isLoading)&lt;BR /&gt;return;&lt;/P&gt;&lt;P&gt;var faultCategoryField = 'u_fault_category';&lt;BR /&gt;g_form.clearOptions(faultCategoryField);&lt;/P&gt;&lt;P&gt;if (newValue == "" || newValue == null)&lt;BR /&gt;return;&lt;/P&gt;&lt;P&gt;var ga = new GlideAjax('NCS_FaultCategoryAjax');&lt;BR /&gt;ga.addParam('sysparm_name', 'getFaultCategoriesByOpsCategory');&lt;BR /&gt;ga.addParam('sysparm_ops_category', newValue);&lt;/P&gt;&lt;P&gt;ga.getXMLAnswer(function(response) {&lt;BR /&gt;if (!response)&lt;BR /&gt;return;&lt;/P&gt;&lt;P&gt;var choices = JSON.parse(response);&lt;BR /&gt;g_form.clearOptions(faultCategoryField);&lt;/P&gt;&lt;P&gt;for (var i = 0; i &amp;lt; choices.length; i++) {&lt;BR /&gt;g_form.addOption(&lt;BR /&gt;faultCategoryField,&lt;BR /&gt;choices[i].value,&lt;BR /&gt;choices[i].label&lt;BR /&gt;);&lt;BR /&gt;}&lt;BR /&gt;});&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;I am attaching screen shot of mapping category, please refer that.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="harshal001_0-1781677267364.png" style="width: 400px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/520124i417367460EA4FC96/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="harshal001_0-1781677267364.png" alt="harshal001_0-1781677267364.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;please provide you guidance. Thank you&amp;nbsp;&lt;BR /&gt;#client-script # Servicenow&amp;nbsp; #glideajax&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jun 2026 06:19:29 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/g-form-addoption-not-rendering-choices-on-field-switch/m-p/3560346#M1258029</guid>
      <dc:creator>harshal001</dc:creator>
      <dc:date>2026-06-17T06:19:29Z</dc:date>
    </item>
    <item>
      <title>Re: g_form.addOption() not rendering choices on field switch — ServiceNow Client Script Issue</title>
      <link>https://www.servicenow.com/community/developer-forum/g-form-addoption-not-rendering-choices-on-field-switch/m-p/3560362#M1258033</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/880605"&gt;@harshal001&lt;/a&gt;&amp;nbsp; - Can you try without SI.&amp;nbsp; similar to this&amp;nbsp;&lt;A href="https://www.servicenow.com/community/developer-forum/g-form-addoption-on-client-script-used-to-show-choices-on-select/m-p/1775716" target="_blank"&gt;https://www.servicenow.com/community/developer-forum/g-form-addoption-on-client-script-used-to-show-choices-on-select/m-p/1775716&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;Reference SN doc for more information:&amp;nbsp;&amp;nbsp;&lt;/EM&gt;&lt;A href="https://developer.servicenow.com/dev.do#!/reference/api/yokohama/client/c_GlideFormAPI#r_GlideForm-AddOption_S_S_S_N" target="_blank"&gt;https://developer.servicenow.com/dev.do#!/reference/api/yokohama/client/c_GlideFormAPI#r_GlideForm-AddOption_S_S_S_N&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jun 2026 06:34:17 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/g-form-addoption-not-rendering-choices-on-field-switch/m-p/3560362#M1258033</guid>
      <dc:creator>AbhitK</dc:creator>
      <dc:date>2026-06-17T06:34:17Z</dc:date>
    </item>
    <item>
      <title>Re: g_form.addOption() not rendering choices on field switch — ServiceNow Client Script Issue</title>
      <link>https://www.servicenow.com/community/developer-forum/g-form-addoption-not-rendering-choices-on-field-switch/m-p/3560371#M1258036</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/880605"&gt;@harshal001&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;try this :&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || oldValue === newValue)
        return;
    var field = 'u_fault_category';
    // Reset field
    g_form.setValue(field, '');
    g_form.clearOptions(field);
    g_form.addOption(field, '', '-- None --', 0);
    if (!newValue)
        return;
    var selectedCategory = newValue;
    var ga = new GlideAjax('NCS_FaultCategoryAjax');
    ga.addParam('sysparm_name', 'getFaultCategoriesByOpsCategory');
    ga.addParam('sysparm_ops_category', selectedCategory);
    ga.getXMLAnswer(function(answer) {
        // Ignore stale Ajax responses
        if (g_form.getValue('u_operations_category') != selectedCategory)
            return;
        if (!answer)
            return;
        var choices = JSON.parse(answer);
        g_form.clearOptions(field);
        g_form.addOption(field, '', '-- None --', 0);
        choices.forEach(function(choice) {
            g_form.addOption(field, choice.value, choice.label);
        });

    });
}&lt;/LI-CODE&gt;&lt;P&gt;&lt;STRONG&gt;*************************************************************************************************************************************&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If this response helps, please mark it as Accept as Solution and Helpful.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Doing so helps others in the community and encourages me to keep contributing.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Regards&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Vaishali Singh&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Servicenow Developer &lt;/STRONG&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;STRONG&gt;Linkedin - &lt;/STRONG&gt;&lt;A href="https://www.linkedin.com/in/vaishali-singh-2273361bb" target="_blank"&gt;&lt;STRONG&gt;https://www.linkedin.com/in/vaishali-singh-2273361bb&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jun 2026 06:56:24 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/g-form-addoption-not-rendering-choices-on-field-switch/m-p/3560371#M1258036</guid>
      <dc:creator>vaishali231</dc:creator>
      <dc:date>2026-06-17T06:56:24Z</dc:date>
    </item>
    <item>
      <title>Re: g_form.addOption() not rendering choices on field switch — ServiceNow Client Script Issue</title>
      <link>https://www.servicenow.com/community/developer-forum/g-form-addoption-not-rendering-choices-on-field-switch/m-p/3560396#M1258039</link>
      <description>&lt;P&gt;I have try this method only using client script&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;function onChange(control, oldValue, newValue, isLoading) {&lt;/P&gt;&lt;P&gt;if (isLoading || oldValue === newValue)&lt;BR /&gt;return;&lt;/P&gt;&lt;P&gt;var faultCategoryField = 'u_fault_category';&lt;/P&gt;&lt;P&gt;g_form.setValue(faultCategoryField, '');&lt;BR /&gt;g_form.clearOptions(faultCategoryField);&lt;BR /&gt;g_form.addOption(faultCategoryField, '', '-- None --', 0);&lt;/P&gt;&lt;P&gt;if (!newValue)&lt;BR /&gt;return;&lt;/P&gt;&lt;P&gt;var categoryMapping = {&lt;BR /&gt;'fault': [&lt;BR /&gt;{ label: 'Hardware Replacement', value: 'hardware_replacement' },&lt;BR /&gt;{ label: 'Software Fault Remediation', value: 'Software Fault Remediation' },&lt;BR /&gt;{ label: 'Non Hardware Fault - Troubleshooting', value: 'troubleshooting' }&lt;BR /&gt;],&lt;BR /&gt;'service_request': [&lt;BR /&gt;{ label: 'Call Management - Hardware Replacement', value: 'call_management_Hardware_Replacement' },&lt;BR /&gt;{ label: 'Call Management - Software Remediation', value: 'call_management_Others' },&lt;BR /&gt;{ label: 'Call Management - UPS Hardware Replacement', value: 'call_management_UPS_Hardware_Replacement' },&lt;BR /&gt;{ label: 'Call Management - Fans &amp;amp; Cable Replacement', value: 'call_management_Fans_Cable_Replacement' },&lt;BR /&gt;{ label: 'Call Management - UPS', value: 'call_management_ups' },&lt;BR /&gt;{ label: 'Call Management - Service Request', value: 'call_management_Service_Request' }&lt;BR /&gt;],&lt;BR /&gt;'standby_request': [&lt;BR /&gt;{ label: 'License or Software Download Request', value: 'license_or_Software_Download_Request' },&lt;BR /&gt;{ label: 'Upgrade/Patch Services', value: 'upgrade_patch_Services' },&lt;BR /&gt;{ label: 'Configuration Assistance', value: 'configuration_assistance' },&lt;BR /&gt;{ label: 'Preventive Maintenance Service', value: 'preventive_maintenance_service' }&lt;BR /&gt;],&lt;BR /&gt;'inquiry': [&lt;BR /&gt;{ label: 'Inquiry', value: 'Inquiry' },&lt;BR /&gt;{ label: 'No MA Coverage', value: 'no_ma_coverage' },&lt;BR /&gt;{ label: 'Vulnerability Check Only', value: 'vulnerability_check_only' }&lt;BR /&gt;],&lt;BR /&gt;'sadhoc_ request': [&lt;BR /&gt;{ label: 'Hardware Replacement', value: 'hardware_replacement' },&lt;BR /&gt;{ label: 'Software Fault Remediation', value: 'Software Fault Remediation' },&lt;BR /&gt;{ label: 'Non Hardware Fault - Troubleshooting', value: 'troubleshooting' },&lt;BR /&gt;{ label: 'Call Management - Hardware Replacement', value: 'call_management_Hardware_Replacement' },&lt;BR /&gt;{ label: 'Call Management - Software Remediation', value: 'call_management_Others' },&lt;BR /&gt;{ label: 'Call Management - UPS Hardware Replacement', value: 'call_management_UPS_Hardware_Replacement' },&lt;BR /&gt;{ label: 'Call Management - Fans &amp;amp; Cable Replacement', value: 'call_management_Fans_Cable_Replacement' },&lt;BR /&gt;{ label: 'Call Management - UPS', value: 'call_management_ups' },&lt;BR /&gt;{ label: 'Call Management - Service Request', value: 'call_management_Service_Request' },&lt;BR /&gt;{ label: 'License or Software Download Request', value: 'license_or_Software_Download_Request' },&lt;BR /&gt;{ label: 'Upgrade/Patch Services', value: 'upgrade_patch_Services' },&lt;BR /&gt;{ label: 'Configuration Assistance', value: 'configuration_assistance' },&lt;BR /&gt;{ label: 'Preventive Maintenance Service', value: 'preventive_maintenance_service' },&lt;BR /&gt;{ label: 'Inquiry', value: 'Inquiry' },&lt;BR /&gt;{ label: 'No MA Coverage', value: 'no_ma_coverage' },&lt;BR /&gt;{ label: 'Vulnerability Check Only', value: 'vulnerability_check_only' },&lt;BR /&gt;{ label: 'Standby Request', value: 'standby_request' }&lt;BR /&gt;]&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;var choices = categoryMapping[newValue] || [];&lt;/P&gt;&lt;P&gt;for (var i = 0; i &amp;lt; choices.length; i++) {&lt;BR /&gt;g_form.addOption(&lt;BR /&gt;faultCategoryField,&lt;BR /&gt;choices[i].value,&lt;BR /&gt;choices[i].label&lt;BR /&gt;);&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;but still It is not displaying choice in fault category&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jun 2026 07:31:07 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/g-form-addoption-not-rendering-choices-on-field-switch/m-p/3560396#M1258039</guid>
      <dc:creator>harshal001</dc:creator>
      <dc:date>2026-06-17T07:31:07Z</dc:date>
    </item>
    <item>
      <title>Re: g_form.addOption() not rendering choices on field switch — ServiceNow Client Script Issue</title>
      <link>https://www.servicenow.com/community/developer-forum/g-form-addoption-not-rendering-choices-on-field-switch/m-p/3560401#M1258040</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/915527"&gt;@vaishali231&lt;/a&gt;&amp;nbsp; I try this way as well but did display choice in fault cate.&lt;BR /&gt;If possible, could please share script include and client script both&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jun 2026 07:33:53 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/g-form-addoption-not-rendering-choices-on-field-switch/m-p/3560401#M1258040</guid>
      <dc:creator>harshal001</dc:creator>
      <dc:date>2026-06-17T07:33:53Z</dc:date>
    </item>
    <item>
      <title>Re: g_form.addOption() not rendering choices on field switch — ServiceNow Client Script Issue</title>
      <link>https://www.servicenow.com/community/developer-forum/g-form-addoption-not-rendering-choices-on-field-switch/m-p/3560406#M1258041</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/880605"&gt;@harshal001&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can try with it:&lt;/P&gt;&lt;P&gt;function onChange(control, oldValue, newValue, isLoading, isTemplate) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (isLoading || newValue === '') {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;&amp;nbsp;&amp;nbsp;g_form.clearOptions('fault_category'); &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; g_form.addOption('fault_category', '', '-- None --');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp; g_form.clearOptions('fault_category');&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; g_form.addOption('fault_category', '', '-- None --');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var ga = new GlideAjax('YourScriptIncludeName');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ga.addParam('sysparm_name', 'getFaultCategories');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ga.addParam('sysparm_ops_category', newValue);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ga.getXMLAnswer(function(response) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (response) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var choices = JSON.parse(response);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (var i = 0; i &amp;lt; choices.length; i++) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; g_form.addOption('fault_category', choices[i].value, choices[i].label);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jun 2026 07:41:36 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/g-form-addoption-not-rendering-choices-on-field-switch/m-p/3560406#M1258041</guid>
      <dc:creator>Tanushree Maiti</dc:creator>
      <dc:date>2026-06-17T07:41:36Z</dc:date>
    </item>
    <item>
      <title>Re: g_form.addOption() not rendering choices on field switch — ServiceNow Client Script Issue</title>
      <link>https://www.servicenow.com/community/developer-forum/g-form-addoption-not-rendering-choices-on-field-switch/m-p/3560407#M1258042</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/880605"&gt;@harshal001&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;H3&gt;&lt;STRONG&gt;Script Include (Client Callable)&lt;/STRONG&gt;&lt;/H3&gt;&lt;LI-CODE lang="markup"&gt;var NCS_FaultCategoryAjax = Class.create();
NCS_FaultCategoryAjax.prototype = Object.extendsObject(AbstractAjaxProcessor, {
   getFaultCategoriesByOpsCategory: function() {
       var opsCategory = this.getParameter('sysparm_ops_category');
       var categoryMapping = {
           fault: [
               {
                   label: 'Hardware Replacement',
                   value: 'hardware_replacement'
               },

               {

                   label: 'Software Fault Remediation',
                   value: 'software_fault_remediation'

               },

               {

                   label: 'Non Hardware Fault - Troubleshooting',

                   value: 'troubleshooting'

               },

               {

                   label: 'Call Management - Hardware Replacement',

                   value: 'call_management_hardware_replacement'

               },

               {

                   label: 'Call Management - Software Remediation',

                   value: 'call_management_software_remediation'

               },

               {

                   label: 'Call Management - UPS Hardware Replacement',

                   value: 'call_management_ups_hardware_replacement'

               }

           ],



           service_request: [

               {

                   label: 'Call Management - UPS',

                   value: 'call_management_ups'

               },

               {

                   label: 'Call Management - Service Request',

                   value: 'call_management_service_request'

               },

               {

                   label: 'Standby Request',

                   value: 'standby_request'

               },

               {

                   label: 'Vulnerability Check Only',

                   value: 'vulnerability_check_only'

               },

               {

                   label: 'Preventive Maintenance Service',

                   value: 'preventive_maintenance_service'

               },

               {

                   label: 'Upgrade/Patch Services',

                   value: 'upgrade_patch_services'

               },

               {

                   label: 'License or Software Download Request',

                   value: 'license_software_download_request'

               },

               {

                   label: 'Configuration Assistance',

                   value: 'configuration_assistance'

               }

           ],
           inquiry: [

               {

                   label: 'Inquiry',

                   value: 'inquiry'

               },

               {

                   label: 'No MA Coverage',

                   value: 'no_ma_coverage'

               }

           ],



           adhoc_request: [

               {

                   label: 'Hardware Replacement',

                   value: 'hardware_replacement'

               },

               {

                   label: 'Software Fault Remediation',

                   value: 'software_fault_remediation'

               },

               {

                   label: 'Non Hardware Fault - Troubleshooting',

                   value: 'troubleshooting'

               },

               {

                   label: 'Call Management - Hardware Replacement',

                   value: 'call_management_hardware_replacement'

               },

               {

                   label: 'Call Management - Software Remediation',

                   value: 'call_management_software_remediation'
               },

               {

                   label: 'Call Management - UPS Hardware Replacement',
                   value: 'call_management_ups_hardware_replacement'

               }

           ]

       };

       return JSON.stringify(categoryMapping[opsCategory] || []);

   },

   type: 'NCS_FaultCategoryAjax'

});&lt;/LI-CODE&gt;&lt;H3&gt;&lt;STRONG&gt;Client Script (onChange on (&lt;/STRONG&gt;&lt;STRONG&gt;u_operations_category&lt;/STRONG&gt;&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/H3&gt;&lt;LI-CODE lang="markup"&gt;function onChange(control, oldValue, newValue, isLoading) {
   if (isLoading || oldValue == newValue)
       return;
   var field = 'u_fault_category';
   // Reset field
   g_form.setValue(field, '');
   g_form.clearOptions(field);
   g_form.addOption(field, '', '-- None --', 0);
   if (!newValue)
       return;
   var selectedCategory = newValue;
   var ga = new GlideAjax('NCS_FaultCategoryAjax');
   ga.addParam('sysparm_name', 'getFaultCategoriesByOpsCategory');
   ga.addParam('sysparm_ops_category', selectedCategory);
   ga.getXMLAnswer(function(answer) {
       // Ignore old AJAX responses
       if (g_form.getValue('u_operations_category') != selectedCategory)
           return;
       if (!answer)
           return;
       var choices = JSON.parse(answer);
       g_form.clearOptions(field);
       g_form.addOption(field, '', '-- None --', 0);
       for (var i = 0; i &amp;lt; choices.length; i++) {
           g_form.addOption(
               field,
               choices[i].value,
               choices[i].label
           );
       }
       g_form.setValue(field, '');
   });
}


&lt;/LI-CODE&gt;&lt;P&gt;&lt;STRONG&gt;*********************************************************************************************************&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If this response helps, please mark it as Accept as Solution and Helpful.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Doing so helps others in the community and encourages me to keep contributing.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Regards&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Vaishali Singh&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Servicenow Developer &lt;/STRONG&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;STRONG&gt;Linkedin - &lt;/STRONG&gt;&lt;A href="https://www.linkedin.com/in/vaishali-singh-2273361bb" target="_blank"&gt;&lt;STRONG&gt;https://www.linkedin.com/in/vaishali-singh-2273361bb&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jun 2026 07:43:39 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/g-form-addoption-not-rendering-choices-on-field-switch/m-p/3560407#M1258042</guid>
      <dc:creator>vaishali231</dc:creator>
      <dc:date>2026-06-17T07:43:39Z</dc:date>
    </item>
    <item>
      <title>Re: g_form.addOption() not rendering choices on field switch — ServiceNow Client Script Issue</title>
      <link>https://www.servicenow.com/community/developer-forum/g-form-addoption-not-rendering-choices-on-field-switch/m-p/3560434#M1258047</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/880605"&gt;@harshal001&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Script Include:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var NCS_FaultCategoryAjax = Class.create();
NCS_FaultCategoryAjax.prototype = Object.extendsObject(AbstractAjaxProcessor, {

    getFaultCategoriesByOpsCategory: function() {
        var opsCategory = this.getParameter('sysparm_ops_category');

        var categoryMapping = {
            'fault': [{
                    label: 'Hardware Replacement',
                    value: 'hardware_replacement'
                },
                {
                    label: 'Software Fault Remediation',
                    value: 'Software Fault Remediation'
                },
                {
                    label: 'Non Hardware Fault - Troubleshooting',
                    value: 'troubleshooting'
                }
            ],
            'service_request': [{
                    label: 'Call Management - Hardware Replacement',
                    value: 'call_management_Hardware_Replacement'
                },
                {
                    label: 'Call Management - Software Remediation',
                    value: 'call_management_Others'
                },
                {
                    label: 'Call Management - UPS Hardware Replacement',
                    value: 'call_management_UPS_Hardware_Replacement'
                },
                {
                    label: 'Call Management - Fans &amp;amp; Cable Replacement',
                    value: 'call_management_Fans_Cable_Replacement'
                },
                {
                    label: 'Call Management - UPS',
                    value: 'call_management_ups'
                },
                {
                    label: 'Call Management - Service Request',
                    value: 'call_management_Service_Request'
                }
            ],
            'standby_request': [{
                    label: 'License or Software Download Request',
                    value: 'license_or_Software_Download_Request'
                },
                {
                    label: 'Upgrade/Patch Services',
                    value: 'upgrade_patch_Services'
                },
                {
                    label: 'Configuration Assistance',
                    value: 'configuration_assistance'
                },
                {
                    label: 'Preventive Maintenance Service',
                    value: 'preventive_maintenance_service'
                }
            ],
            'inquiry': [{
                    label: 'Inquiry',
                    value: 'Inquiry'
                },
                {
                    label: 'No MA Coverage',
                    value: 'no_ma_coverage'
                },
                {
                    label: 'Vulnerability Check Only',
                    value: 'vulnerability_check_only'
                }
            ],
            'sadhoc_request': [{
                    label: 'Hardware Replacement',
                    value: 'hardware_replacement'
                },
                {
                    label: 'Software Fault Remediation',
                    value: 'Software Fault Remediation'
                },
                {
                    label: 'Non Hardware Fault - Troubleshooting',
                    value: 'troubleshooting'
                },
                {
                    label: 'Call Management - Hardware Replacement',
                    value: 'call_management_Hardware_Replacement'
                },
                {
                    label: 'Call Management - Software Remediation',
                    value: 'call_management_Others'
                },
                {
                    label: 'Call Management - UPS Hardware Replacement',
                    value: 'call_management_UPS_Hardware_Replacement'
                },
                {
                    label: 'Call Management - Fans &amp;amp; Cable Replacement',
                    value: 'call_management_Fans_Cable_Replacement'
                },
                {
                    label: 'Call Management - UPS',
                    value: 'call_management_ups'
                },
                {
                    label: 'Call Management - Service Request',
                    value: 'call_management_Service_Request'
                },
                {
                    label: 'License or Software Download Request',
                    value: 'license_or_Software_Download_Request'
                },
                {
                    label: 'Upgrade/Patch Services',
                    value: 'upgrade_patch_Services'
                },
                {
                    label: 'Configuration Assistance',
                    value: 'configuration_assistance'
                },
                {
                    label: 'Preventive Maintenance Service',
                    value: 'preventive_maintenance_service'
                },
                {
                    label: 'Inquiry',
                    value: 'Inquiry'
                },
                {
                    label: 'No MA Coverage',
                    value: 'no_ma_coverage'
                },
                {
                    label: 'Vulnerability Check Only',
                    value: 'vulnerability_check_only'
                },
                {
                    label: 'Standby Request',
                    value: 'standby_request'
                }
            ]
        };
        var result = categoryMapping[opsCategory] || [];
        return JSON.stringify(result);
    },
    type: 'NCS_FaultCategoryAjax'
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;onChange Client Script:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || oldValue === newValue)
        return;
    var field = 'u_fault_category';
    // Reset field
    g_form.setValue(field, '');
    g_form.clearOptions(field);
    g_form.addOption(field, '', '-- None --', 0);
    if (!newValue)
        return;
    var selectedCategory = newValue;
    var ga = new GlideAjax('NCS_FaultCategoryAjax');
    ga.addParam('sysparm_name', 'getFaultCategoriesByOpsCategory');
    ga.addParam('sysparm_ops_category', selectedCategory);
    ga.getXMLAnswer(function(answer) {
        // Ignore stale Ajax responses
        if (g_form.getValue('u_operations_category') != selectedCategory)
            return;
        if (!answer)
            return;
        var choices = JSON.parse(answer);
        g_form.clearOptions(field);
        g_form.addOption(field, '', '-- None --', 0);
        choices.forEach(function(choice) {
            g_form.addOption(field, choice.value, choice.label);
        });
    });
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Make sure there is no space in the choice values.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jun 2026 08:06:08 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/g-form-addoption-not-rendering-choices-on-field-switch/m-p/3560434#M1258047</guid>
      <dc:creator>Abhit</dc:creator>
      <dc:date>2026-06-17T08:06:08Z</dc:date>
    </item>
    <item>
      <title>Re: g_form.addOption() not rendering choices on field switch — ServiceNow Client Script Issue</title>
      <link>https://www.servicenow.com/community/developer-forum/g-form-addoption-not-rendering-choices-on-field-switch/m-p/3560484#M1258050</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/293986"&gt;@Abhit&lt;/a&gt;&amp;nbsp;I have tried this script, in choice table their space between the choice values. but still what&lt;SPAN&gt;&amp;nbsp;is happening here when i select any First choice in Operations category then fault choice displayed as mapping done, but when switch the choice for operation category then in fault category choices are not displayed without reloading the page&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jun 2026 09:39:02 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/g-form-addoption-not-rendering-choices-on-field-switch/m-p/3560484#M1258050</guid>
      <dc:creator>harshal001</dc:creator>
      <dc:date>2026-06-17T09:39:02Z</dc:date>
    </item>
    <item>
      <title>Re: g_form.addOption() not rendering choices on field switch — ServiceNow Client Script Issue</title>
      <link>https://www.servicenow.com/community/developer-forum/g-form-addoption-not-rendering-choices-on-field-switch/m-p/3560489#M1258051</link>
      <description>&lt;P&gt;&lt;SPAN&gt;what is happening here when i select any First choice in Operations category then fault choice displayed as mapping done, but when switch the choice for operation category then in fault category choices are not displayed without reloading the page.... This issue I am getting now.&lt;BR /&gt;&lt;BR /&gt;Even I have try with dictionary table configuration Depend on field Checkbox checked&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;This way Fault, Service Request, Inquiry is mapping directly using dictionary choice dependent field. but for adhoc only i am getting this issue&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jun 2026 09:41:25 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/g-form-addoption-not-rendering-choices-on-field-switch/m-p/3560489#M1258051</guid>
      <dc:creator>harshal001</dc:creator>
      <dc:date>2026-06-17T09:41:25Z</dc:date>
    </item>
    <item>
      <title>Re: g_form.addOption() not rendering choices on field switch — ServiceNow Client Script Issue</title>
      <link>https://www.servicenow.com/community/developer-forum/g-form-addoption-not-rendering-choices-on-field-switch/m-p/3560495#M1258052</link>
      <description>&lt;P&gt;I tried the same code on my PDI, and it works fine.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jun 2026 09:49:32 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/g-form-addoption-not-rendering-choices-on-field-switch/m-p/3560495#M1258052</guid>
      <dc:creator>Abhit</dc:creator>
      <dc:date>2026-06-17T09:49:32Z</dc:date>
    </item>
    <item>
      <title>Re: g_form.addOption() not rendering choices on field switch — ServiceNow Client Script Issue</title>
      <link>https://www.servicenow.com/community/developer-forum/g-form-addoption-not-rendering-choices-on-field-switch/m-p/3560501#M1258053</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/880605"&gt;@harshal001&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;From your description, it looks like the Script Include is working correctly because the Fault Category choices are populated the first time you select an Operations Category. The problem occurs only when switching to another Operations Category without reloading the form.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;A few questions and observations:&lt;/SPAN&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;SPAN&gt;Is &lt;/SPAN&gt;&lt;SPAN&gt;u_fault_category&lt;/SPAN&gt;&lt;SPAN&gt; a Choice field or a Reference field?&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;Are you testing this in Classic UI, Service Portal, or Workspace?&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;SPAN&gt;You mentioned that enabling the Dependent field in the Dictionary works correctly for Fault, Service Request, and Inquiry, but not for Adhoc. That suggests the issue is likely related to the field configuration or choice records rather than the GlideAjax call itself.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Please verify the following:&lt;/STRONG&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;STRONG&gt;Dependent Choice Configuration&lt;/STRONG&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;Check whether the Adhoc choices exist in the &lt;/SPAN&gt;&lt;SPAN&gt;sys_choice&lt;/SPAN&gt;&lt;SPAN&gt; table with the correct&amp;nbsp; &amp;nbsp; Dependent Value.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;If Adhoc does not have matching dependent choice records, the field will appear blank after the parent value changes.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2. Client Script&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Before repopulating the choices, reset the field value and clear the existing options:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;g_form.setValue('u_fault_category', '');&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;g_form.clearOptions('u_fault_category');&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;g_form.addOption('u_fault_category', '', '-- None --', 0);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;3. GlideAjax Response&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Add a &lt;/SPAN&gt;&lt;SPAN&gt;console.log(response);&lt;/SPAN&gt;&lt;SPAN&gt; inside the callback to confirm that the Script Include is returning the expected JSON when Adhoc is selected.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;4. Conflicting Logic&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Check for any other Client Scripts, UI Policies, or Dictionary dependencies that may be clearing or filtering the choices after your callback executes.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Since the issue occurs only for Adhoc, my first suspicion would be that the dependent choice configuration or the mapping for Adhoc is incomplete or conflicting with the dynamically added options.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Could you also share:&lt;/STRONG&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;SPAN&gt;The choice records for Operations Category = Adhoc.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;Whether &lt;/SPAN&gt;&lt;SPAN&gt;u_fault_category&lt;/SPAN&gt;&lt;SPAN&gt; is using both Dictionary dependent choices and GlideAjax at the same time?&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;SPAN&gt;Using both approaches together can sometimes result in the dynamically added options being removed by the platform's built-in dependent choice filtering.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;*********************************************************************************************************&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If this response helps, please mark it as Accept as Solution and Helpful.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Doing so helps others in the community and encourages me to keep contributing.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Regards&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Vaishali Singh&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Servicenow Developer &lt;/STRONG&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;STRONG&gt;Linkedin - &lt;/STRONG&gt;&lt;A href="https://www.linkedin.com/in/vaishali-singh-2273361bb" target="_blank" rel="noopener"&gt;&lt;STRONG&gt;https://www.linkedin.com/in/vaishali-singh-2273361bb&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jun 2026 09:55:11 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/g-form-addoption-not-rendering-choices-on-field-switch/m-p/3560501#M1258053</guid>
      <dc:creator>vaishali231</dc:creator>
      <dc:date>2026-06-17T09:55:11Z</dc:date>
    </item>
    <item>
      <title>Re: g_form.addOption() not rendering choices on field switch — ServiceNow Client Script Issue</title>
      <link>https://www.servicenow.com/community/developer-forum/g-form-addoption-not-rendering-choices-on-field-switch/m-p/3560504#M1258054</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/293986"&gt;@Abhit&lt;/a&gt;&amp;nbsp;Are you able to see fault choice while keep changing operations category ?&lt;BR /&gt;&lt;BR /&gt;Fault category is String type Field&amp;nbsp;&lt;/P&gt;&lt;P&gt;Operations category is String type field&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jun 2026 09:58:58 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/g-form-addoption-not-rendering-choices-on-field-switch/m-p/3560504#M1258054</guid>
      <dc:creator>harshal001</dc:creator>
      <dc:date>2026-06-17T09:58:58Z</dc:date>
    </item>
    <item>
      <title>Re: g_form.addOption() not rendering choices on field switch — ServiceNow Client Script Issue</title>
      <link>https://www.servicenow.com/community/developer-forum/g-form-addoption-not-rendering-choices-on-field-switch/m-p/3560506#M1258055</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/915527"&gt;@vaishali231&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;u_operations_category and U_fault_category is String type Fields.&lt;/P&gt;&lt;P&gt;I am testing it on Classic UI(Native Ui) in incident.do form&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jun 2026 10:01:00 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/g-form-addoption-not-rendering-choices-on-field-switch/m-p/3560506#M1258055</guid>
      <dc:creator>harshal001</dc:creator>
      <dc:date>2026-06-17T10:01:00Z</dc:date>
    </item>
    <item>
      <title>Re: g_form.addOption() not rendering choices on field switch — ServiceNow Client Script Issue</title>
      <link>https://www.servicenow.com/community/developer-forum/g-form-addoption-not-rendering-choices-on-field-switch/m-p/3560508#M1258056</link>
      <description>&lt;OL&gt;&lt;LI&gt;&lt;SPAN&gt;The choice records for Operations Category = Adhoc.&lt;BR /&gt;-- For Adhoc = all choices should be Display in Fault category in problem statement i have attached Screen shot.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;Whether&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;u_fault_category&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;is using both Dictionary dependent choices and GlideAjax at the same time?&amp;nbsp;&lt;BR /&gt;-- previous i have done that but later i remove dependent choice and completely doing on script only.&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;</description>
      <pubDate>Wed, 17 Jun 2026 10:04:02 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/g-form-addoption-not-rendering-choices-on-field-switch/m-p/3560508#M1258056</guid>
      <dc:creator>harshal001</dc:creator>
      <dc:date>2026-06-17T10:04:02Z</dc:date>
    </item>
    <item>
      <title>Re: g_form.addOption() not rendering choices on field switch — ServiceNow Client Script Issue</title>
      <link>https://www.servicenow.com/community/developer-forum/g-form-addoption-not-rendering-choices-on-field-switch/m-p/3560509#M1258057</link>
      <description>&lt;DIV&gt;&lt;P&gt;Yes, it does.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;The &lt;STRONG&gt;Fault Choice&lt;/STRONG&gt; dynamically changes based on the selected &lt;STRONG&gt;Operations Category&lt;/STRONG&gt; without requiring the form to be saved.&lt;/P&gt;&lt;P&gt;However, once the form is saved and reloaded, the &lt;STRONG&gt;Fault Choice&lt;/STRONG&gt; retains the previously selected value and does not display the updated list according to the current &lt;STRONG&gt;Operations Category&lt;/STRONG&gt;.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;To ensure all relevant choices are displayed based on the selected &lt;STRONG&gt;Operations Category&lt;/STRONG&gt;, you need to modify the &lt;EM&gt;isLoading&lt;/EM&gt; condition in the script.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 17 Jun 2026 10:05:46 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/g-form-addoption-not-rendering-choices-on-field-switch/m-p/3560509#M1258057</guid>
      <dc:creator>Abhit</dc:creator>
      <dc:date>2026-06-17T10:05:46Z</dc:date>
    </item>
    <item>
      <title>Re: g_form.addOption() not rendering choices on field switch — ServiceNow Client Script Issue</title>
      <link>https://www.servicenow.com/community/developer-forum/g-form-addoption-not-rendering-choices-on-field-switch/m-p/3561003#M1258116</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/915527"&gt;@vaishali231&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;Since our Fault category is Sting type field. So, I have made all choice under that Fault category from dictionary table made inactive and From the Script include passing all choice as array with their respective mapping. Now it is working as expected.&lt;BR /&gt;&lt;BR /&gt;So Is it is correct approach for implementing this scenario??&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jun 2026 03:58:11 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/g-form-addoption-not-rendering-choices-on-field-switch/m-p/3561003#M1258116</guid>
      <dc:creator>harshal001</dc:creator>
      <dc:date>2026-06-18T03:58:11Z</dc:date>
    </item>
    <item>
      <title>Re: g_form.addOption() not rendering choices on field switch — ServiceNow Client Script Issue</title>
      <link>https://www.servicenow.com/community/developer-forum/g-form-addoption-not-rendering-choices-on-field-switch/m-p/3561004#M1258117</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/293986"&gt;@Abhit&lt;/a&gt;&amp;nbsp;Since our Fault category is Sting type field. So, I have made all choice under that Fault category from dictionary table made inactive and From the Script include passing all choice as array with their respective mapping. and using on change client script making call, Now it is working as expected.&lt;BR /&gt;&lt;BR /&gt;So Is it is correct approach for implementing this scenario??&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jun 2026 03:59:13 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/g-form-addoption-not-rendering-choices-on-field-switch/m-p/3561004#M1258117</guid>
      <dc:creator>harshal001</dc:creator>
      <dc:date>2026-06-18T03:59:13Z</dc:date>
    </item>
  </channel>
</rss>

