How can I hide a user from the "assign to" choices ?

F_bio Santos
Kilo Sage

Hi everyone, I have been asked to remove a user from the "assign to" choices, in this case the users that open the records, shouldnt be abble to assign it to this certain user.

10 REPLIES 10

Hi @Dr Atul G- LNG in this case the user is the "director" of the company and he does not want for the users to be abble to assign him to record producers, I did a reference qualifier for the field on the table, so now when the ticket is opened they cant assign it to him, but on the creation they can ... is there any way to do this by script ?

Hi @F_bio Santos 

 

Got the point. This is more on process side. Today it may be director and tomorrow can be other user type as well. 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

VaishnaviShinde
Kilo Sage

Hello @F_bio Santos ,

 

Create new SI and add below function in that

checkCity1: function(item) {
        gs.info('In SI item:' + item);
        var arr = [];
        var gr = "";
        var userid = "";
        if (item == '04b7e94b4f7b4200086eeed18110c7fd') { // add your record producers sys_id in or conditions
            gr = new GlideRecord("sys_user");
            gr.addEncodedQuery("name!=Abraham Lincoln^active=true"); //Add your User Name
            gr.query();
            while (gr.next()) {
                userid = gr.getUniqueValue();
                arr.push(userid.toString());
            }
            gs.info('IN SIarr:' + arr)
        } else {
            gr = new GlideRecord("sys_user");
            gr.addActiveQuery();
            gr.query();
            while (gr.next()) {
                userid = gr.getUniqueValue();
                arr.push(userid.toString());
            }
        }

        return 'sys_idIN' + arr.join(',');
    },

 

Add the below line to dictionary override entry of Requested Item table:

javascript: new exculdeUsers().checkCity1(current.cat_item);

 

VaishnaviShinde_0-1706698603790.png

 

Please Mark my Solution as Accept and Give me thumbs up, if you find it Helpful.

 

Regards,

Vaishnavi Shinde

 

Hi @VaishnaviShinde, the problem with this is that everytime a new record producer is created this SI wont work for it, isnt there any way to just say that the user cant be assigned in any situation ?

Hi @F_bio Santos ,

 

Yes 

Add the below line in reference qualifier, for now I have added reference qualifier to Dictionary entry of Requested Item table. You can add the below line for your table.

 

javascript: 'name!=Abraham Lincoln^name!=Abel Tuter (enterprise architect)^active=true';

 

VaishnaviShinde_0-1706714618261.png

 

 

Please Mark my Solution as Accept and Give me thumbs up, if you find it Helpful.

 

Regards,

Vaishnavi Shinde