Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

I have to write a script include to exclude the Assignment group from choosing the user .

swetha kurukund
Kilo Explorer

Hi All, 

 

I have to write a script include to exclude the Assignment group from choosing the user . 

I am going to call this script include function in the reference qualifier . 

Assignment group is a reference type field

 

Below is the script include i have created but it is not working accordingly . I am not sure how to exclude that one group and return all the other group as it is in that assignment group field .

 

var Hide _groups = Class.create();

Hide_ groups.prototype = {

              filters1: function() {

             

                             //Quering on group

                            

                             var gr = new GlideRecord('sys_user_group');

                            gr.addQuery('name',XYZ);       // XYZ is the name of the assignment group .This is the only group i am trying to exclude showing from the list                       

                             gr.query();

                             var qry =[];

                             while(gr.next()){

                                                          qry.push(gr.sys_id.toString());

                                                         

                                           }

                                                          else qry.push(gr.sys_id.toString());

                             }

             

                             },

             

              type: 'Hide _groups'

};

17 REPLIES 17

asifnoor
Kilo Patron

Hi,

Is that grup static or you want to hide the assignment group which is selected?

 

All, 

 

I am good . Thank you so much . 

 

I tried in other way and it worked . 

 

Thanks. 

Did you try the last response i posted??


Please mark my response as correct and helpful if it helped solved your question.
-Thanks