<?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 get all initial values of choice field in a record producer in Community Central forum</title>
    <link>https://www.servicenow.com/community/community-central-forum/get-all-initial-values-of-choice-field-in-a-record-producer/m-p/3438712#M5508</link>
    <description>&lt;P&gt;There is a choice field in a Record Producer that has values from 10:00 AM thru 5:00 PM with each hour having 4 entries in 15 minute intervals (i.e. 10:00 AM, 10:15 AM, 10:30 AM &amp;amp; 10:45 AM &amp;amp; so on).&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I want these values to compare against an application that may already have some records with those times.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If an application record has 10:15 AM then the choice field in the Record Producer needs to show that entry as unavailable choice.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The script pulls the entries from the application but the .getControl or .getOptions or other attempts to retrieve the initial choice field values fail to be programmatically retrieved to do any compare between the Record Producer and the applications records that were retrieved.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;function onLoad() {&lt;/P&gt;&lt;P&gt;//Query for all times already allotted on the Date specified.&lt;BR /&gt;var pdate = g_form.getValue('photoshoot_date');&lt;BR /&gt;console.log('pdate: ' + pdate);&lt;BR /&gt;var ga = new GlideAjax('PhotoshootSlotChecker');&lt;BR /&gt;ga.addParam('sysparm_name', 'getUnavailableSlots');&lt;BR /&gt;ga.addParam('sysparm_date', pdate);&lt;BR /&gt;//&lt;BR /&gt;ga.getXMLAnswer(function(response) {&lt;BR /&gt;var unavailable = response.split(',');&lt;BR /&gt;var timeSlotField = g_form.getControl('time_slot');&lt;BR /&gt;console.log('timeSlotField.options.length: ' + timeSlotField.options[1] + '\nunavailable: ' + unavailable);&lt;BR /&gt;for (var i = 0; i &amp;lt; timeSlotField.option.length; i++) {&lt;BR /&gt;var option = timeSlotField.options[i];&lt;BR /&gt;console.log('unavailable: ' + unavailable + " option.value: " + option.value);&lt;BR /&gt;if (unavailable.includes(option.value)) {&lt;BR /&gt;option.disabled = true;&lt;BR /&gt;option.text += ' (Unavailable)';&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;</description>
    <pubDate>Wed, 26 Nov 2025 20:12:56 GMT</pubDate>
    <dc:creator>GabeF</dc:creator>
    <dc:date>2025-11-26T20:12:56Z</dc:date>
    <item>
      <title>get all initial values of choice field in a record producer</title>
      <link>https://www.servicenow.com/community/community-central-forum/get-all-initial-values-of-choice-field-in-a-record-producer/m-p/3438712#M5508</link>
      <description>&lt;P&gt;There is a choice field in a Record Producer that has values from 10:00 AM thru 5:00 PM with each hour having 4 entries in 15 minute intervals (i.e. 10:00 AM, 10:15 AM, 10:30 AM &amp;amp; 10:45 AM &amp;amp; so on).&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I want these values to compare against an application that may already have some records with those times.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If an application record has 10:15 AM then the choice field in the Record Producer needs to show that entry as unavailable choice.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The script pulls the entries from the application but the .getControl or .getOptions or other attempts to retrieve the initial choice field values fail to be programmatically retrieved to do any compare between the Record Producer and the applications records that were retrieved.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;function onLoad() {&lt;/P&gt;&lt;P&gt;//Query for all times already allotted on the Date specified.&lt;BR /&gt;var pdate = g_form.getValue('photoshoot_date');&lt;BR /&gt;console.log('pdate: ' + pdate);&lt;BR /&gt;var ga = new GlideAjax('PhotoshootSlotChecker');&lt;BR /&gt;ga.addParam('sysparm_name', 'getUnavailableSlots');&lt;BR /&gt;ga.addParam('sysparm_date', pdate);&lt;BR /&gt;//&lt;BR /&gt;ga.getXMLAnswer(function(response) {&lt;BR /&gt;var unavailable = response.split(',');&lt;BR /&gt;var timeSlotField = g_form.getControl('time_slot');&lt;BR /&gt;console.log('timeSlotField.options.length: ' + timeSlotField.options[1] + '\nunavailable: ' + unavailable);&lt;BR /&gt;for (var i = 0; i &amp;lt; timeSlotField.option.length; i++) {&lt;BR /&gt;var option = timeSlotField.options[i];&lt;BR /&gt;console.log('unavailable: ' + unavailable + " option.value: " + option.value);&lt;BR /&gt;if (unavailable.includes(option.value)) {&lt;BR /&gt;option.disabled = true;&lt;BR /&gt;option.text += ' (Unavailable)';&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;</description>
      <pubDate>Wed, 26 Nov 2025 20:12:56 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/get-all-initial-values-of-choice-field-in-a-record-producer/m-p/3438712#M5508</guid>
      <dc:creator>GabeF</dc:creator>
      <dc:date>2025-11-26T20:12:56Z</dc:date>
    </item>
  </channel>
</rss>

