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

AA6
Tera Contributor

Hi 

Calvaresi E.
 

I Have one catalog item which is "user management add/remove/modify catalog item" in this catalog item we have one field is there which is "Are you part of AIS" This field has two choices (yes, No) whenever we are selecting the "yes" option then one field is visible 

Are you part of AIS?

yes

NO

user groups                     Type of change
(here it is taking the user table), (here it is taking group table), (add/remove/modify)

all dropdowns are choices.

Based on the field I want to visible groups list. for example (Are you part of AIS? is "yes" then here is it is visible only AIS-related groups), (Are you part of AIS? is "NO" then here is it removes all parent groups and PPO G groups)

 please help me.

Prateek kumar
Mega Sage

Why would you even need a script include.

In the reference qualifier just add the condition, Name--is not -- Your group name.


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

Hi Praeek, 

 

I tried this way but it is not hiding the group on the UI level. 

 

javascript:assignment_group.name!*groupname --- Groupname is the group i am trying to hide it . 

 

javascript:assignment_group.nameNOT LIKEgroupname  ---

Groupname is the group i am trying to hide it . 

 

Tried both ways but did not work . 

 

find_real_file.png

Why are you using LIKE operator??

find_real_file.png


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

I used this as well 

 

javascript:assignment_group.name!=groupname  //Groupname is the group i am trying to hide it. 

 

I am not doing this in the assignment group field --> Reference specification. 

 

I am using this script under the same field where directory overrides have tables with reference to this field. 

 

See below i am placing script there .