Dynamic Filter for List collector value

Samiksha2
Mega Sage

Hi All.

I have a list collector (BL)in the customer_contact table. Values are:

ABC
XYZ

 

I have to add a dynamic filter in the Case table to get the list of cases whose contact has above BL.

 

I have written already created the dynamic filter but it is not working

 

Samiksha2_0-1728463774970.png

 

Samiksha2_1-1728463809042.png

I have run the same script in the Background. It is returning values.

 

Samiksha2_2-1728463853960.pngSamiksha2_3-1728463867834.png

Samiksha2_4-1728463900626.png


Please let me know what i am doing wrong

Thanks,
Sam

3 REPLIES 3

vermaamit16
Kilo Patron

Hi @Samiksha2 

 

You are not returning an array from your Script Include. Before you while loop, initialize an empty array like 

var blCases= [];

 

Then, inside the while loop, push the elements to this array and return the array. Refer this post and give it a try https://www.servicenow.com/community/developer-articles/create-your-own-dynamic-filters/ta-p/2321052

 

Thanks and Regards

Amit Verma

Thanks and Regards
Amit Verma

Hi @vermaamit16 ,
I updated the script still nothing is coming in the logs as well as filter.

getBusGroup: function() {
	gs.log("Business LineBusiness Line");
        var t = new GlideRecord("sn_customerservice_case");
        t.addEncodedQuery("contact=c07424a54f781200025ba3618110c746");
        t.query();
        if (t.next()) {
            var name = t.contact;
            gs.log(name);
            var s = new GlideRecord("customer_contact");
            s.addEncodedQuery("sys_id=" + name);
            s.query();
			var user= [];
            while (s.next()) {
                
                user.push(s.u_bl_hhgh.getDisplayValue());
                //var n = s.u_bl_hhgh.getDisplayValue();
                
            }
        }
		gs.log('Business Line'+ n);
		return user;
    },


Thanks,
Sam

Samiksha2
Mega Sage

Hi All,

Please help me.

Thanks,
Sam