<?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: Reference qualifier is not working properly in Developer forum</title>
    <link>https://www.servicenow.com/community/developer-forum/reference-qualifier-is-not-working-properly/m-p/2966948#M1123654</link>
    <description>&lt;P&gt;L3Category variable I am using in if condition for checking L3 category is empty or not like below&lt;/P&gt;&lt;P&gt;if (!L1Category) {&lt;BR /&gt;if (!L3Category) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code is working fine but the only issue is it is working only first time. Suppose I select category in L1 category field then L2 will show all child category. I select one category in L2 category field but when i go to choose other option it is giving no matches found. PFB snap.&lt;/P&gt;&lt;P&gt;First time selection&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Brijmohan_0-1718769924909.png"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/365872iCB70703FDC68E94B/image-size/medium?v=v2&amp;amp;px=400" alt="Brijmohan_0-1718769924909.png" title="Brijmohan_0-1718769924909.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Second time selection&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Brijmohan_1-1718769967424.png"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/365873i1DE222FC5C30A30C/image-size/medium?v=v2&amp;amp;px=400" alt="Brijmohan_1-1718769967424.png" title="Brijmohan_1-1718769967424.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 19 Jun 2024 04:06:39 GMT</pubDate>
    <dc:creator>Brijmohan</dc:creator>
    <dc:date>2024-06-19T04:06:39Z</dc:date>
    <item>
      <title>Reference qualifier is not working properly</title>
      <link>https://www.servicenow.com/community/developer-forum/reference-qualifier-is-not-working-properly/m-p/2966274#M1123436</link>
      <description>&lt;P&gt;Hi All, I am working on record producer where I have 3 variables L1 category, L2 category and L3 category. I need to set these variables values depended on each other. I am able to get the values based on filter applied in script include but it is working only first time. Is there anything that I am missing in my script or any way to achieve this requirement and should give filtered record on every selection not only first time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Scenario 1: If user select L1 category then only child categories should show in L2 category variable.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Result : It is showing only child categories like we have a, b and c three child categories and I selected a but when I want to change other category in L2 variable it is showing no record found.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Scenario 1: If L1 and L3 is empty then only those categories should show whose have child and parent category.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Result :&amp;nbsp;It is showing categories as per filter but when I want to change other category in L2 variable it is showing no record found.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PFB script include that I am using in reference qualifier.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;getLevel2Category: function(L3Category, L1Category) {
        var returnIds = [];
        var grModelCategory = new GlideRecord("cmdb_model_category");
        if (!L1Category) {
            if (!L3Category) {
                // check if parent category is not empty
                grModelCategory.addEncodedQuery("parent_cateogryISNOTEMPTY");
                grModelCategory.query();
                while (grModelCategory.next()) {
                    // Ensure the current category should have any child categories
                    var childCategoryCheck = new GlideRecord("cmdb_model_category");
                    childCategoryCheck.addQuery("parent_cateogry", grModelCategory.sys_id);
                    childCategoryCheck.query();
                    if (childCategoryCheck.hasNext()) {
                        var tempId = grModelCategory.getUniqueValue();
                        returnIds.push(tempId);
                    }
                }
            }
        } else {
            // Query for child categories with the specified parent category
            var encQuery = "parent_cateogry.sys_id=" + L1Category;
            grModelCategory.addEncodedQuery(encQuery);
            grModelCategory.query();
            while (grModelCategory.next()) {
                tempId = grModelCategory.getUniqueValue();
                returnIds.push(tempId);
            }
        }
             return "sys_idIN" + returnIds.toString();   
    },
&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Variable configuration&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Brijmohan_0-1718713493201.png"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/365717iDCE49B70DA6819CE/image-size/medium?v=v2&amp;amp;px=400" alt="Brijmohan_0-1718713493201.png" title="Brijmohan_0-1718713493201.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Brijmohan_1-1718713544697.png"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/365718i7AA27F392A78D75A/image-size/medium?v=v2&amp;amp;px=400" alt="Brijmohan_1-1718713544697.png" title="Brijmohan_1-1718713544697.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks and regards,&lt;/P&gt;&lt;P&gt;Brijmohan&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2024 13:00:23 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/reference-qualifier-is-not-working-properly/m-p/2966274#M1123436</guid>
      <dc:creator>Brijmohan</dc:creator>
      <dc:date>2024-06-18T13:00:23Z</dc:date>
    </item>
    <item>
      <title>Re: Reference qualifier is not working properly</title>
      <link>https://www.servicenow.com/community/developer-forum/reference-qualifier-is-not-working-properly/m-p/2966337#M1123464</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/171287"&gt;@Brijmohan&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;no where in your script include function query you are using the value of the previous variable which should be used to filter&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2024 13:00:28 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/reference-qualifier-is-not-working-properly/m-p/2966337#M1123464</guid>
      <dc:creator>Ankur Bawiskar</dc:creator>
      <dc:date>2024-06-18T13:00:28Z</dc:date>
    </item>
    <item>
      <title>Re: Reference qualifier is not working properly</title>
      <link>https://www.servicenow.com/community/developer-forum/reference-qualifier-is-not-working-properly/m-p/2966555#M1123535</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/265966"&gt;@Ankur Bawiskar&lt;/a&gt;&amp;nbsp;Thanks for you response but I didn't get you. If you are talking about query, I am using below condition if we have any value in L1 category in else condition&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;var encQuery = "parent_cateogry.sys_id=" + L1Category;&lt;BR /&gt;grModelCategory.addEncodedQuery(encQuery);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;where L1Category contain value of L1 variable.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2024 15:24:33 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/reference-qualifier-is-not-working-properly/m-p/2966555#M1123535</guid>
      <dc:creator>Brijmohan</dc:creator>
      <dc:date>2024-06-18T15:24:33Z</dc:date>
    </item>
    <item>
      <title>Re: Reference qualifier is not working properly</title>
      <link>https://www.servicenow.com/community/developer-forum/reference-qualifier-is-not-working-properly/m-p/2966936#M1123651</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/171287"&gt;@Brijmohan&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;what about L3Category variable? you are not using it anywhere&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2024 03:36:49 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/reference-qualifier-is-not-working-properly/m-p/2966936#M1123651</guid>
      <dc:creator>Ankur Bawiskar</dc:creator>
      <dc:date>2024-06-19T03:36:49Z</dc:date>
    </item>
    <item>
      <title>Re: Reference qualifier is not working properly</title>
      <link>https://www.servicenow.com/community/developer-forum/reference-qualifier-is-not-working-properly/m-p/2966948#M1123654</link>
      <description>&lt;P&gt;L3Category variable I am using in if condition for checking L3 category is empty or not like below&lt;/P&gt;&lt;P&gt;if (!L1Category) {&lt;BR /&gt;if (!L3Category) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code is working fine but the only issue is it is working only first time. Suppose I select category in L1 category field then L2 will show all child category. I select one category in L2 category field but when i go to choose other option it is giving no matches found. PFB snap.&lt;/P&gt;&lt;P&gt;First time selection&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Brijmohan_0-1718769924909.png"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/365872iCB70703FDC68E94B/image-size/medium?v=v2&amp;amp;px=400" alt="Brijmohan_0-1718769924909.png" title="Brijmohan_0-1718769924909.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Second time selection&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Brijmohan_1-1718769967424.png"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/365873i1DE222FC5C30A30C/image-size/medium?v=v2&amp;amp;px=400" alt="Brijmohan_1-1718769967424.png" title="Brijmohan_1-1718769967424.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2024 04:06:39 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/reference-qualifier-is-not-working-properly/m-p/2966948#M1123654</guid>
      <dc:creator>Brijmohan</dc:creator>
      <dc:date>2024-06-19T04:06:39Z</dc:date>
    </item>
  </channel>
</rss>

