The CreatorCon Call for Content is officially open! Get started here.

Dynamic Filter Option (exclude Parent Groups)

michaelcory
Giga Expert

The OOB Dynamic Filter pulls in Parent groups.   I inserted new Dynamic Filter Option and the Business Rule that it references.    Is there a way to modify the Business Rule so that it doesn't pull in the Parent Groups.   Only want the script to pulll in groups  that have a "Type" that contains Incident, Task, or Change.   All of the parent groups don't have a "Type" value.

1 ACCEPTED SOLUTION

Sorry Mike just notice you have your getMyAssignments declared on the prototype.   You are going to want to move it of the prototype definition so you can call it directly without creating a UserUtil object:



var UserUtil = Class.create();



UserUtil.prototype = {


      initialize: function() {


      },


      type: 'UserUtil'


};




UserUtil.getMyAssignmentGroups = function(userID){


    var queryString = "user=" + userID + "^group.typeLIKE52c230cd21412400abe30817dc6fb00f^ORtypeLIKEa59723f0213d6800abe30817dc6fb09d^ORtypeLIKE2da8677721056400abe30817dc6fb0fe";


   


var groupsArray = [];


    var gr = new GlideRecord('sys_user_grmember');


    gr.addEncodedQuery(queryString);


    gr.query();


while (gr.next()) {


      groupsArray.push(gr.group.toString());


}


        return groupsArray;


  },


View solution in original post

10 REPLIES 10

Aditya Telideva
ServiceNow Employee
ServiceNow Employee

Hi Mike,


The below link could help you :


Dynamically filter a reference field



Also, can you please atach a screenshot for my easy reference?


Thanks,


Adi