show inactive users records in catalog

Harish27
Kilo Guru

Hi,

I have a field Requested on Behalf on a catalog item which is a reference field to the sys_user table. By default, we will be able to see only active users in the Requested field, But I also want to see inactive users in the requested field.

1. One solution for this is to give the user_admin role to a particular user(not the best solution though) and we are not allowed to modify the OOTB business rule as well.

I heard that some business rule is locking the user session to only show active records.. Don't know much abt that.

 

So how we achieve this? Any help would be massively appreciated..

Thanks!!

1 ACCEPTED SOLUTION

Harish27
Kilo Guru

Thank you ankur and jaspal. I have written and article on this https://community.servicenow.com/community?id=community_article&sys_id=e2f2878bdbd4ec1011762183ca961... . This solves my requirement.

View solution in original post

18 REPLIES 18

Hi Harish,

please check the url looks something like this when you open it from the lookup icon besides the variable

it contains the variable information -> i.e. sys_id sysparm_target=IO:677f33d54ffda700fc11fa218110c710

highlighted in bold is the variable sys_id from the table "item_option_new"

So you can use this to restrict the BR not to run for this variable

Note: you use the sys_id of your variable from the "item_option_new" table

Updated Script:

var url = gs.action.getGlideURI().toString();

var index = url.toString().indexOf('sysparm_target=IO:677f33d54ffda700fc11fa218110c710');

if (index == -1) {
      current.addActiveQuery();
}

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Ankur,

I have followed the same steps which you have mentioned.

I have created a script include which contains the above script and calling it in the onchange client script on the catalog item. But It doesn't seem to be working or maybe I have done something wrong.

Can u please help.

Script Include:

OnChange client Script on Catalog:

 

Thank you!

Hi Harish,

you need to update the out of the box "user query" business rule

no other change required; no onchange; no script include

find_real_file.png

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Ankur,

 

I have tried this as well it is not working for me.

find_real_file.png

 

This is my test catalog item

 

find_real_file.png

 

Please help me on this.

 

Thank you!

Hi Hari,

When you open the Catalog item on Portal can you kindly help with the URL as well once.