<?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 how to use LIKE in query in Developer forum</title>
    <link>https://www.servicenow.com/community/developer-forum/how-to-use-like-in-query/m-p/1875810#M532736</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have this query and instead of using LIKE and sysid i need to use LIKE and the var product.&lt;/P&gt;
&lt;P&gt;What is the right way to replacing the sys ID with the variable product?&lt;/P&gt;
&lt;P&gt;u_allowed_duplication is of a type list and its a reference to a table, so i need to filter using contains which is LIKE.&lt;/P&gt;
&lt;P&gt;bs.addEncodedQuery('name=' + user + ^u_allowed_duplication_swLIKEda1d2ffc1b3db05073542f02604bcbcb')&lt;/P&gt;</description>
    <pubDate>Mon, 19 Sep 2022 11:25:42 GMT</pubDate>
    <dc:creator>Alon Grod</dc:creator>
    <dc:date>2022-09-19T11:25:42Z</dc:date>
    <item>
      <title>how to use LIKE in query</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-use-like-in-query/m-p/1875810#M532736</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have this query and instead of using LIKE and sysid i need to use LIKE and the var product.&lt;/P&gt;
&lt;P&gt;What is the right way to replacing the sys ID with the variable product?&lt;/P&gt;
&lt;P&gt;u_allowed_duplication is of a type list and its a reference to a table, so i need to filter using contains which is LIKE.&lt;/P&gt;
&lt;P&gt;bs.addEncodedQuery('name=' + user + ^u_allowed_duplication_swLIKEda1d2ffc1b3db05073542f02604bcbcb')&lt;/P&gt;</description>
      <pubDate>Mon, 19 Sep 2022 11:25:42 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-use-like-in-query/m-p/1875810#M532736</guid>
      <dc:creator>Alon Grod</dc:creator>
      <dc:date>2022-09-19T11:25:42Z</dc:date>
    </item>
    <item>
      <title>Re: how to use LIKE in query</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-use-like-in-query/m-p/1875811#M532737</link>
      <description>&lt;P&gt;Hi Alon,&lt;/P&gt;
&lt;P&gt;try this:&lt;/P&gt;
&lt;PRE class="language-javascript"&gt;&lt;CODE&gt;bs.addQuery('name=' + user);
bs.addQuery('u_allowed_duplication', 'CONTAINS', 'be3db45f0f0a0200883347bce1050e41');
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 19 Sep 2022 11:48:17 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-use-like-in-query/m-p/1875811#M532737</guid>
      <dc:creator>Beata I_owiecka</dc:creator>
      <dc:date>2022-09-19T11:48:17Z</dc:date>
    </item>
    <item>
      <title>Re: how to use LIKE in query</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-use-like-in-query/m-p/1875812#M532738</link>
      <description>&lt;P&gt;Hi Aon,&lt;/P&gt;
&lt;P&gt;To replace the hard-coded sys_id with a variable depends on where you are running this script, but generally the syntax is current.variables.variable_name, so you can do this with an encoded query:&lt;/P&gt;
&lt;PRE class="language-javascript"&gt;&lt;CODE&gt;bs.addEncodedQuery('name=' + user + '^u_allowed_duplication_swLIKE' + current.variables.product);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or 2 addQuery lines:&lt;/P&gt;
&lt;PRE class="language-javascript"&gt;&lt;CODE&gt;bs.addQuery('name', user);
bs.addQuery('u_allowed_duplication', 'CONTAINS', current.variables.product);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;both of these examples assume 'user' is defined elsewhere in the script.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Sep 2022 12:10:46 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-use-like-in-query/m-p/1875812#M532738</guid>
      <dc:creator>Brad Bowman</dc:creator>
      <dc:date>2022-09-19T12:10:46Z</dc:date>
    </item>
    <item>
      <title>Re: how to use LIKE in query</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-use-like-in-query/m-p/1875813#M532739</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;if it possible with addQuery go with it because easy to understand.&lt;/P&gt;
&lt;P&gt;for your requirement try this.&lt;/P&gt;
&lt;P&gt;bs.addQuery('name', user); //if Operator is blank it will take it as =&lt;BR /&gt;bs.addQuery('u_allowed_duplication', 'CONTAINS', product); //you get product sysid on it pass it or use current.product&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope you it helps you.&lt;/P&gt;
&lt;P&gt;Please Mark &lt;span class="lia-unicode-emoji" title=":white_heavy_check_mark:"&gt;✅&lt;/span&gt; Correct/helpful if applicable, Thanks!!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Regards&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Pavankumar&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Sep 2022 12:16:27 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-use-like-in-query/m-p/1875813#M532739</guid>
      <dc:creator>PavanK960672992</dc:creator>
      <dc:date>2022-09-19T12:16:27Z</dc:date>
    </item>
    <item>
      <title>Re: how to use LIKE in query</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-use-like-in-query/m-p/1875814#M532740</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Brad has already mentioned the approach.&lt;/P&gt;
&lt;P&gt;Did you try to check that?&lt;/P&gt;
&lt;P&gt;Regards&lt;BR /&gt;Ankur&lt;/P&gt;</description>
      <pubDate>Mon, 19 Sep 2022 13:47:40 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-use-like-in-query/m-p/1875814#M532740</guid>
      <dc:creator>Ankur Bawiskar</dc:creator>
      <dc:date>2022-09-19T13:47:40Z</dc:date>
    </item>
    <item>
      <title>Re: how to use LIKE in query</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-use-like-in-query/m-p/1875815#M532741</link>
      <description>&lt;P&gt;Hi &lt;SN-MENTION class="sn-mention" table="live_profile" sysid="823ee466db4cd1d03321db85ca9619e0"&gt;@Alon Grod&lt;/SN-MENTION&gt;,&lt;/P&gt;
&lt;P&gt;It is strange to me without checking the responses you or someone are marking the question as correct/helpful.&lt;/P&gt;
&lt;P&gt;Please make sure validate the responses and mark only which you tried or which are helpful otherwise how this thread will help others and you as well.&lt;/P&gt;
&lt;P&gt;There is no use if anyone marks the helpful as comments and try to hit helpful or accept the solution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Regards&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Pavankumar&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Sep 2022 05:25:04 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-use-like-in-query/m-p/1875815#M532741</guid>
      <dc:creator>PavanK960672992</dc:creator>
      <dc:date>2022-09-20T05:25:04Z</dc:date>
    </item>
  </channel>
</rss>

