<?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 to query multiple values in a 'state' in ITSM forum</title>
    <link>https://www.servicenow.com/community/itsm-forum/how-to-query-multiple-values-in-a-state/m-p/466934#M38713</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The suggested &lt;A href="https://developer.servicenow.com/dev.do#!/reference/api/rome/server/no-namespace/c_GlideRecordScopedAPI#r_ScopedGlideRecordAddEncodedQuery_String?navFilter=addEncodedQuery"&gt;addEncodedQuery &lt;/A&gt;is 1 option.&lt;/P&gt;
&lt;P&gt;You can also do it via the &lt;A href="https://developer.servicenow.com/dev.do#!/reference/api/paris/server/no-namespace/c_GlideQueryConditionScopedAPI#r_ScopedGlideQueryConditionOrAddCondition_String_name_String_oper_Object_value?navFilter=addOrCondition"&gt;addOrCondition&lt;/A&gt;:&lt;/P&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;
&lt;PRE class="language-javascript"&gt;&lt;CODE&gt;var grIncident2 = new GlideRecord('incident');
grIncident2.addQuery('incident_state',6).addOrCondition('incident_state',7).addOrCondition('incident_state',8);
grIncident2.query();
gs.print("COUNT IS : " + grIncident2.getRowCount());&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;P&gt;Or even via the &lt;A href="https://docs.servicenow.com/bundle/rome-application-development/page/app-store/dev_portal/API_reference/GlideRecord/concept/c_GlideRecordAPI.html#r_GlideRecord-AddQuery_String_Object_Object"&gt;addQuery&lt;/A&gt;&amp;nbsp;with IN:&lt;/P&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;
&lt;PRE class="language-javascript"&gt;&lt;CODE&gt;var grIncident = new GlideRecord('incident');
grIncident.addQuery('incident_stateIN6,7,8');
grIncident.query();
gs.print("COUNT IS : " + grIncident.getRowCount());​&lt;/CODE&gt;&lt;/PRE&gt;
Regards,&lt;/DIV&gt;
&lt;DIV&gt;Hayo&lt;/DIV&gt;</description>
    <pubDate>Sun, 16 Jan 2022 12:34:29 GMT</pubDate>
    <dc:creator>Hayo Lubbers</dc:creator>
    <dc:date>2022-01-16T12:34:29Z</dc:date>
    <item>
      <title>How to query multiple values in a 'state'</title>
      <link>https://www.servicenow.com/community/itsm-forum/how-to-query-multiple-values-in-a-state/m-p/466930#M38709</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;I wanted to check if an incident record is available with either resolved state or closed state or cancelled state&lt;/P&gt;
&lt;P&gt;is below script for querying the table right?&lt;/P&gt;
&lt;P&gt;inc.addQuery('state=7'||'state=6'||'state=8');&amp;nbsp; &amp;nbsp;// is this querying right?? as am not getting the output&lt;/P&gt;
&lt;P&gt;Please advice&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Sandeep&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 15 Jan 2022 17:52:51 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/how-to-query-multiple-values-in-a-state/m-p/466930#M38709</guid>
      <dc:creator>Sandeep109</dc:creator>
      <dc:date>2022-01-15T17:52:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to query multiple values in a 'state'</title>
      <link>https://www.servicenow.com/community/itsm-forum/how-to-query-multiple-values-in-a-state/m-p/466931#M38710</link>
      <description>&lt;P&gt;Use servicenow UI&amp;nbsp; to generate the queries&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&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/23122i4A76FCF5646F3465/image-size/large?v=v2&amp;amp;px=999" role="button" title="find_real_file.png" alt="find_real_file.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;stateIN1,2,3&lt;/P&gt;
&lt;P&gt;Use&lt;/P&gt;
&lt;P&gt;inc.addEncodedQuery('stateIN1,2,3');&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 15 Jan 2022 18:05:35 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/how-to-query-multiple-values-in-a-state/m-p/466931#M38710</guid>
      <dc:creator>vkachineni</dc:creator>
      <dc:date>2022-01-15T18:05:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to query multiple values in a 'state'</title>
      <link>https://www.servicenow.com/community/itsm-forum/how-to-query-multiple-values-in-a-state/m-p/466932#M38711</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;Please use it as&amp;nbsp;&lt;/P&gt;
&lt;P&gt;inc.addEncodedQuery('stateIN6,7,8');&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please mark answer correct/helpful based on Impact&lt;/P&gt;</description>
      <pubDate>Sat, 15 Jan 2022 18:44:22 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/how-to-query-multiple-values-in-a-state/m-p/466932#M38711</guid>
      <dc:creator>Saurav11</dc:creator>
      <dc:date>2022-01-15T18:44:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to query multiple values in a 'state'</title>
      <link>https://www.servicenow.com/community/itsm-forum/how-to-query-multiple-values-in-a-state/m-p/466933#M38712</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN class="ng-binding"&gt;Sandeep,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try the below code in Background script. It will give you the count of&amp;nbsp;either Incident resolved or closed or cancelled state.&lt;/P&gt;
&lt;P&gt;var incstate = new GlideRecord('incident');&lt;BR /&gt; incstate.addEncodedQuery('incident_stateIN6,7,8');&lt;BR /&gt; incstate.query();&lt;BR /&gt; gs.print("COUNT IS--" + incstate.getRowCount());&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want some manipulation after this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;var incstate = new GlideRecord('incident');&lt;BR /&gt; incstate.addEncodedQuery('incident_stateIN6,7,8');&lt;BR /&gt; incstate.query();&lt;BR /&gt; while (incstate.next()&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;//Your code&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;</description>
      <pubDate>Sun, 16 Jan 2022 11:57:01 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/how-to-query-multiple-values-in-a-state/m-p/466933#M38712</guid>
      <dc:creator>Sunny Khandelwa</dc:creator>
      <dc:date>2022-01-16T11:57:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to query multiple values in a 'state'</title>
      <link>https://www.servicenow.com/community/itsm-forum/how-to-query-multiple-values-in-a-state/m-p/466934#M38713</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The suggested &lt;A href="https://developer.servicenow.com/dev.do#!/reference/api/rome/server/no-namespace/c_GlideRecordScopedAPI#r_ScopedGlideRecordAddEncodedQuery_String?navFilter=addEncodedQuery"&gt;addEncodedQuery &lt;/A&gt;is 1 option.&lt;/P&gt;
&lt;P&gt;You can also do it via the &lt;A href="https://developer.servicenow.com/dev.do#!/reference/api/paris/server/no-namespace/c_GlideQueryConditionScopedAPI#r_ScopedGlideQueryConditionOrAddCondition_String_name_String_oper_Object_value?navFilter=addOrCondition"&gt;addOrCondition&lt;/A&gt;:&lt;/P&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;
&lt;PRE class="language-javascript"&gt;&lt;CODE&gt;var grIncident2 = new GlideRecord('incident');
grIncident2.addQuery('incident_state',6).addOrCondition('incident_state',7).addOrCondition('incident_state',8);
grIncident2.query();
gs.print("COUNT IS : " + grIncident2.getRowCount());&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;P&gt;Or even via the &lt;A href="https://docs.servicenow.com/bundle/rome-application-development/page/app-store/dev_portal/API_reference/GlideRecord/concept/c_GlideRecordAPI.html#r_GlideRecord-AddQuery_String_Object_Object"&gt;addQuery&lt;/A&gt;&amp;nbsp;with IN:&lt;/P&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;
&lt;PRE class="language-javascript"&gt;&lt;CODE&gt;var grIncident = new GlideRecord('incident');
grIncident.addQuery('incident_stateIN6,7,8');
grIncident.query();
gs.print("COUNT IS : " + grIncident.getRowCount());​&lt;/CODE&gt;&lt;/PRE&gt;
Regards,&lt;/DIV&gt;
&lt;DIV&gt;Hayo&lt;/DIV&gt;</description>
      <pubDate>Sun, 16 Jan 2022 12:34:29 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/how-to-query-multiple-values-in-a-state/m-p/466934#M38713</guid>
      <dc:creator>Hayo Lubbers</dc:creator>
      <dc:date>2022-01-16T12:34:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to query multiple values in a 'state'</title>
      <link>https://www.servicenow.com/community/itsm-forum/how-to-query-multiple-values-in-a-state/m-p/466935#M38714</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Where are you writing this code , can you let me know and accordingly can assist you with the sample code to be used.&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Shloke&lt;/P&gt;</description>
      <pubDate>Sun, 16 Jan 2022 12:38:43 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/how-to-query-multiple-values-in-a-state/m-p/466935#M38714</guid>
      <dc:creator>shloke04</dc:creator>
      <dc:date>2022-01-16T12:38:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to query multiple values in a 'state'</title>
      <link>https://www.servicenow.com/community/itsm-forum/how-to-query-multiple-values-in-a-state/m-p/466936#M38715</link>
      <description>&lt;P&gt;Hi Sholke,&lt;/P&gt;
&lt;P&gt;Got the answer from the above replies&lt;/P&gt;
&lt;P&gt;Thanks anyways&lt;/P&gt;</description>
      <pubDate>Sun, 16 Jan 2022 18:06:17 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/how-to-query-multiple-values-in-a-state/m-p/466936#M38715</guid>
      <dc:creator>Sandeep109</dc:creator>
      <dc:date>2022-01-16T18:06:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to query multiple values in a 'state'</title>
      <link>https://www.servicenow.com/community/itsm-forum/how-to-query-multiple-values-in-a-state/m-p/466937#M38716</link>
      <description>&lt;P&gt;Hello Sandeep,&lt;/P&gt;
&lt;P&gt;Just saw you had marked my answer as correct and then changed it.&lt;/P&gt;
&lt;P&gt;Any reason why?&lt;/P&gt;</description>
      <pubDate>Sun, 16 Jan 2022 18:10:57 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/how-to-query-multiple-values-in-a-state/m-p/466937#M38716</guid>
      <dc:creator>Saurav11</dc:creator>
      <dc:date>2022-01-16T18:10:57Z</dc:date>
    </item>
  </channel>
</rss>

