<?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 Issue with &amp;quot;Dynamic choice&amp;quot; in Virtual agent in Community Central forum</title>
    <link>https://www.servicenow.com/community/community-central-forum/issue-with-quot-dynamic-choice-quot-in-virtual-agent/m-p/2935943#M133</link>
    <description>&lt;P&gt;I want to create a 'Dynamic Choice' in the Virtual Agent to display a list based on the values in the &lt;STRONG&gt;Category&lt;/STRONG&gt; field.&lt;BR /&gt;To achieve this, I have queried the &lt;STRONG&gt;sys_choice&lt;/STRONG&gt; table with the following conditions.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="bondita1_0-1716148812076.png" style="width: 400px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/357953i16A7AC6F173DF8BD/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="bondita1_0-1716148812076.png" alt="bondita1_0-1716148812076.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So that I should get the below option for Category.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="bondita1_1-1716148854636.png" style="width: 400px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/357954i5D1CBFCCA1934990/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="bondita1_1-1716148854636.png" alt="bondita1_1-1716148854636.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have added the below code snippet in my script:&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;function&lt;/SPAN&gt;&lt;SPAN&gt; execute() {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; options = [];&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; gr = &lt;/SPAN&gt;&lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;GlideRecordSecure&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'sys_choice'&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;gr.addEncodedQuery(&lt;/SPAN&gt;&lt;SPAN&gt;'inactive=false^table=incident^element=category'&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;gr.setLimit(&lt;/SPAN&gt;&lt;SPAN&gt;5&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;gr.query();&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;while&lt;/SPAN&gt;&lt;SPAN&gt;(gr.next()) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;options.push({ &lt;/SPAN&gt;&lt;SPAN&gt;'value'&lt;/SPAN&gt;&lt;SPAN&gt;: gr.getUniqueValue(), &lt;/SPAN&gt;&lt;SPAN&gt;'label'&lt;/SPAN&gt;&lt;SPAN&gt;: gr.getValue(&lt;/SPAN&gt;&lt;SPAN&gt;'label'&lt;/SPAN&gt;&lt;SPAN&gt;) });&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;return&lt;/SPAN&gt;&lt;SPAN&gt; options;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;})()&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="bondita1_3-1716149096201.png" style="width: 400px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/357956i88C0B1F50B952041/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="bondita1_3-1716149096201.png" alt="bondita1_3-1716149096201.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;But in my Virtual Agent, I am seeing other options that are not based on the query I provided.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Could someone please help me with this.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 19 May 2024 20:09:16 GMT</pubDate>
    <dc:creator>bondita1</dc:creator>
    <dc:date>2024-05-19T20:09:16Z</dc:date>
    <item>
      <title>Issue with "Dynamic choice" in Virtual agent</title>
      <link>https://www.servicenow.com/community/community-central-forum/issue-with-quot-dynamic-choice-quot-in-virtual-agent/m-p/2935943#M133</link>
      <description>&lt;P&gt;I want to create a 'Dynamic Choice' in the Virtual Agent to display a list based on the values in the &lt;STRONG&gt;Category&lt;/STRONG&gt; field.&lt;BR /&gt;To achieve this, I have queried the &lt;STRONG&gt;sys_choice&lt;/STRONG&gt; table with the following conditions.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="bondita1_0-1716148812076.png" style="width: 400px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/357953i16A7AC6F173DF8BD/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="bondita1_0-1716148812076.png" alt="bondita1_0-1716148812076.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So that I should get the below option for Category.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="bondita1_1-1716148854636.png" style="width: 400px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/357954i5D1CBFCCA1934990/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="bondita1_1-1716148854636.png" alt="bondita1_1-1716148854636.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have added the below code snippet in my script:&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;function&lt;/SPAN&gt;&lt;SPAN&gt; execute() {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; options = [];&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; gr = &lt;/SPAN&gt;&lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;GlideRecordSecure&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'sys_choice'&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;gr.addEncodedQuery(&lt;/SPAN&gt;&lt;SPAN&gt;'inactive=false^table=incident^element=category'&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;gr.setLimit(&lt;/SPAN&gt;&lt;SPAN&gt;5&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;gr.query();&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;while&lt;/SPAN&gt;&lt;SPAN&gt;(gr.next()) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;options.push({ &lt;/SPAN&gt;&lt;SPAN&gt;'value'&lt;/SPAN&gt;&lt;SPAN&gt;: gr.getUniqueValue(), &lt;/SPAN&gt;&lt;SPAN&gt;'label'&lt;/SPAN&gt;&lt;SPAN&gt;: gr.getValue(&lt;/SPAN&gt;&lt;SPAN&gt;'label'&lt;/SPAN&gt;&lt;SPAN&gt;) });&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;return&lt;/SPAN&gt;&lt;SPAN&gt; options;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;})()&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="bondita1_3-1716149096201.png" style="width: 400px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/357956i88C0B1F50B952041/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="bondita1_3-1716149096201.png" alt="bondita1_3-1716149096201.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;But in my Virtual Agent, I am seeing other options that are not based on the query I provided.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Could someone please help me with this.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 19 May 2024 20:09:16 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/issue-with-quot-dynamic-choice-quot-in-virtual-agent/m-p/2935943#M133</guid>
      <dc:creator>bondita1</dc:creator>
      <dc:date>2024-05-19T20:09:16Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with "Dynamic choice" in Virtual agent</title>
      <link>https://www.servicenow.com/community/community-central-forum/issue-with-quot-dynamic-choice-quot-in-virtual-agent/m-p/3012067#M546</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/653312"&gt;@bondita1&lt;/a&gt;&amp;nbsp;- Were you able to figure this out?&lt;/P&gt;</description>
      <pubDate>Wed, 07 Aug 2024 14:59:54 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/issue-with-quot-dynamic-choice-quot-in-virtual-agent/m-p/3012067#M546</guid>
      <dc:creator>goldenjc97</dc:creator>
      <dc:date>2024-08-07T14:59:54Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with "Dynamic choice" in Virtual agent</title>
      <link>https://www.servicenow.com/community/community-central-forum/issue-with-quot-dynamic-choice-quot-in-virtual-agent/m-p/3237243#M2755</link>
      <description>&lt;P&gt;For anyone else having this issue, it has to do with the filter on the query. Instead of 'table = incident' it should instead be 'name = incident'.&lt;/P&gt;&lt;P&gt;EX:&lt;/P&gt;&lt;P&gt;(function execute() {&lt;BR /&gt;&lt;BR /&gt;var options = [];&lt;BR /&gt;var gr = new GlideRecord('sys_choice');&lt;/P&gt;&lt;P&gt;gr.addQuery('inactive', 'false');&lt;BR /&gt;gr.addQuery('name', 'incident');&lt;BR /&gt;gr.addQuery('element','category');&lt;BR /&gt;gr.query();&lt;/P&gt;&lt;P&gt;while(gr.next()) {&lt;BR /&gt;options.push({ 'value': gr.getUniqueValue(), 'label': gr.getValue('label') });&lt;BR /&gt;}&lt;BR /&gt;return options;&lt;/P&gt;&lt;P&gt;})()&lt;/P&gt;</description>
      <pubDate>Mon, 14 Apr 2025 16:07:07 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/issue-with-quot-dynamic-choice-quot-in-virtual-agent/m-p/3237243#M2755</guid>
      <dc:creator>GlideJ</dc:creator>
      <dc:date>2025-04-14T16:07:07Z</dc:date>
    </item>
  </channel>
</rss>

