<?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 check comma seperated field values in gliderecord query. in Employee Slate and Employee Center forum</title>
    <link>https://www.servicenow.com/community/employee-slate-and-employee/how-to-check-comma-seperated-field-values-in-gliderecord-query/m-p/3058138#M10384</link>
    <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/681032"&gt;@Ssinha4&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To check for comma-separated field values in a GlideRecord query, you need to properly parse the values from the field and compare them against your criteria. Check bellow script once and let me know its working or not:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;var gr = new GlideRecord('your_custom_table'); // Replace with your actual table name
gr.addEncodedQuery('u_recipient=' + recipient); 
gr.addNotNullQuery('u_vendor'); 
gr.query();

while (gr.next()) {
    var vendors = gr.u_vendor; 

    if (vendors) {
        // Split the vendors into an array
        var vendorArray = vendors.split(',');

        // Trim whitespace and check if the sender is in the vendor array
        for (var i = 0; i &amp;lt; vendorArray.length; i++) {
            if (vendorArray[i].trim() === sender) {
                // Match found - remaining code here
                gs.info('Match found for sender: ' + sender + ' in vendors for record: ' + gr.sys_id);
                // Add your additional logic here
                break; // Exit loop if match is found
            }
        }
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i hope my answer helps you to resolve your issue, if yes please mark my answer helpful and correct.&lt;/P&gt;&lt;P&gt;thank you&lt;/P&gt;&lt;P&gt;rajesh&lt;/P&gt;</description>
    <pubDate>Fri, 27 Sep 2024 14:21:14 GMT</pubDate>
    <dc:creator>Rajesh Chopade1</dc:creator>
    <dc:date>2024-09-27T14:21:14Z</dc:date>
    <item>
      <title>How to check comma seperated field values in gliderecord query.</title>
      <link>https://www.servicenow.com/community/employee-slate-and-employee/how-to-check-comma-seperated-field-values-in-gliderecord-query/m-p/3058102#M10382</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;We have field on our custom table where we store comma separated values in string type field.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ssinha4_0-1727444765626.png" style="width: 400px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/389957i1DD15A5F99719ACE/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="Ssinha4_0-1727444765626.png" alt="Ssinha4_0-1727444765626.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;We have a inbound action email script&amp;nbsp; but not working.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ssinha4_1-1727444911132.png" style="width: 400px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/389958i302322801C804F61/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="Ssinha4_1-1727444911132.png" alt="Ssinha4_1-1727444911132.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Let me know how can we achieve this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance&lt;/P&gt;</description>
      <pubDate>Fri, 27 Sep 2024 13:49:46 GMT</pubDate>
      <guid>https://www.servicenow.com/community/employee-slate-and-employee/how-to-check-comma-seperated-field-values-in-gliderecord-query/m-p/3058102#M10382</guid>
      <dc:creator>Ssinha4</dc:creator>
      <dc:date>2024-09-27T13:49:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to check comma seperated field values in gliderecord query.</title>
      <link>https://www.servicenow.com/community/employee-slate-and-employee/how-to-check-comma-seperated-field-values-in-gliderecord-query/m-p/3058138#M10384</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/681032"&gt;@Ssinha4&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To check for comma-separated field values in a GlideRecord query, you need to properly parse the values from the field and compare them against your criteria. Check bellow script once and let me know its working or not:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;var gr = new GlideRecord('your_custom_table'); // Replace with your actual table name
gr.addEncodedQuery('u_recipient=' + recipient); 
gr.addNotNullQuery('u_vendor'); 
gr.query();

while (gr.next()) {
    var vendors = gr.u_vendor; 

    if (vendors) {
        // Split the vendors into an array
        var vendorArray = vendors.split(',');

        // Trim whitespace and check if the sender is in the vendor array
        for (var i = 0; i &amp;lt; vendorArray.length; i++) {
            if (vendorArray[i].trim() === sender) {
                // Match found - remaining code here
                gs.info('Match found for sender: ' + sender + ' in vendors for record: ' + gr.sys_id);
                // Add your additional logic here
                break; // Exit loop if match is found
            }
        }
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i hope my answer helps you to resolve your issue, if yes please mark my answer helpful and correct.&lt;/P&gt;&lt;P&gt;thank you&lt;/P&gt;&lt;P&gt;rajesh&lt;/P&gt;</description>
      <pubDate>Fri, 27 Sep 2024 14:21:14 GMT</pubDate>
      <guid>https://www.servicenow.com/community/employee-slate-and-employee/how-to-check-comma-seperated-field-values-in-gliderecord-query/m-p/3058138#M10384</guid>
      <dc:creator>Rajesh Chopade1</dc:creator>
      <dc:date>2024-09-27T14:21:14Z</dc:date>
    </item>
  </channel>
</rss>

