Dynamic Filter Option not working on Filter but does on a Catalog Item

r_daosseili
Kilo Contributor

Hello guys,

I tried to create a dynamic filter that retrieves users for a specific group. It works perfectly when I apply it as a Reference Qualifier on a variable in a Catalog Item, but when I try to apply it as a filter on "Assigned to" in the "Incident" table the Filter shows (empty).

Capture d

The getRITUsers function is defined in an Include Script which is Client Callable and accessible from all application scopes :

var IKUtils = Class.create();

IKUtils.prototype = {

      initialize: function() {

      },

  getRITUsers: function() {

  var user_sys_ids = [];

  var group_members = new GlideRecord('sys_user_grmember');

  group_members.get('group.name','RIT');

  while(group_members.next()){

  user_sys_ids.push(group_members.user.sys_id);

  }

  return "sys_idIN" + user_sys_ids.toString();

  },

      type: 'IKUtils'

};

Capture d

Thank you for your help

1 ACCEPTED SOLUTION

Mwatkins
ServiceNow Employee

Ah, okay. Seems like Dynamic filters don't like the return value "sys_idIN...". They will take a straight array of strings though. Unfortunately, when working with multiple values it seems like Reference Qualifiers work one way and Dynamic Filters work another.



return ["97000fcc0a0a0a6e0104ca999f619e5b", "6816f79cc0a8016401c5a33be04be441"]


Dynamic Filters: Works


Reference Qualifier: Does NOT Work



return "sys_id=97000fcc0a0a0a6e0104ca999f619e5b,6816f79cc0a8016401c5a33be04be441"


Dynamic Filters: Does NOT Work


Reference Qualifier: Works



You'll have to make two different Dynamic Filter Options.


View solution in original post

2 REPLIES 2

Mwatkins
ServiceNow Employee

Ah, okay. Seems like Dynamic filters don't like the return value "sys_idIN...". They will take a straight array of strings though. Unfortunately, when working with multiple values it seems like Reference Qualifiers work one way and Dynamic Filters work another.



return ["97000fcc0a0a0a6e0104ca999f619e5b", "6816f79cc0a8016401c5a33be04be441"]


Dynamic Filters: Works


Reference Qualifier: Does NOT Work



return "sys_id=97000fcc0a0a0a6e0104ca999f619e5b,6816f79cc0a8016401c5a33be04be441"


Dynamic Filters: Does NOT Work


Reference Qualifier: Works



You'll have to make two different Dynamic Filter Options.


Thank you Matthew, you're right But it's weird since there's a possibility to make a Dynamic Filter Option available on both Ref Qualifier and Filter