How to restrict the list of users/users with specific role when using @mention?

Sujatha V M
Kilo Patron
Kilo Patron

Hi Team, 

When an ITIL member uses @mention function in "Worknotes" it should list only the members/users with ITIL role but currently its listing all the users on search. 

In below screenshot, Approver user doesn't have itil role and holds only approver_user role but still its displaying. 

find_real_file.png

 

Kindly help!

Please mark this as helpful and accept it as a solution if this resolves your query.
Sujatha V.M.
7 REPLIES 7

Jaspal Singh
Mega Patron
Mega Patron

Hi Sujatha,

 

I doubt that can be achieved & so does the HI document that states the same. Give it a check.

Megha Padale
Giga Guru

Hi Sujatha,

I don't know any official way to disable it but you can prevent the query on your user table coming from this API with a Before Query business rule.

(function executeRule(current, previous /*null when async*/) {

       

       try{

               if(GlideTransaction.get().URL.startsWith('/api/now/form/mention/record/')){

            current.addQuery('roles', 'itil');

               }

       }


       catch(e){

               

       }


})(current, previous);

 

You could even have some conditions, like role conditions to allow specific roles to do mentions or even add a query based on a specific criteria like a user can see users from his own department or something like that. However, this Business rule will make the @ mention look like a broken feature if no users are available.

Warning: GlideTransaction is an undocumented Java object, ServiceNow could decide to retire it or to change it's behavior without any notice.

If my answer helped you in any way, mark answer as helpful and correct.

Thanks and regards,

Megha.

Hi Megha,

I tried your business rule, it seems to work except that it still shows the name of the caller.

There is any way to avoid that? I want to display only itil role users.

Thanks

Hello Megha, i have try this business rule and it is working on only Dev Platform but not on Agent workspace. why it is happening?