Dynamic Filter for List collector value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2024 01:51 AM
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
I have run the same script in the Background. It is returning values.
Please let me know what i am doing wrong
Thanks,
Sam
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2024 02:11 AM
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
Amit Verma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2024 02:44 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2024 01:11 AM
Hi All,
Please help me.
Thanks,
Sam
