How to limit the specific catalog item to only one department users even the requests raised by the

Archana23
Tera Contributor

How to limit the specific catalog item to only one department users even the requests also  raised by the specific department only.

9 REPLIES 9

Archana23
Tera Contributor

Through this way we can hide the catalog item from others..but how we can hide the requests or sctasks raised for that catalog item.

ohh you mean RITM (sc_req_item) and task (sc_task) created for catalog item.

 

This can be done by adding a before query business rule on each table in which you need to check if logged in user is member of 'Accounting' department (example) and filter others out:

Business rule on each table  sc_req_item and sc_task

add condition in BR as : !gs.hasRole("admin")

Script in BR of sc_req_item table:

 

var catalogItemName = '<specify correct catalog item name>';
//add correct department sys_id below
if (gs.isInteractive() && gs.getUser().getDepartmentID() != ' <sys_id of department>') 
{
 current.addEncodedQuery('cat_item.name!='+catalogItemName);
}

 

Script in BR of sc_task table:

 

var catalogItemName = '<specify correct catalog item name>';
//add correct department sys_id below
if (gs.isInteractive() && gs.getUser().getDepartmentID() != ' <sys_id of department>') 
{
 current.addEncodedQuery('request_item.cat_item.name!='+catalogItemName);
}

 

 

 

 

 

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Regards,Sushant Malsure

Thanks for your answer.

I have tried the same and given the condition too..The admins are able to view the requests and sctasks.

The requirement is Even the admins should not be able to view those.

then remove this condition in BR as : !gs.hasRole("admin") and keep it empty

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Regards,Sushant Malsure

Ankur Bawiskar
Tera Patron
Tera Patron

@Archana23 

For catalog item -> use user criteria

For other tables REQ, RITM, SCTASK -> use combination of query BR and table level READ ACL

what did you start with?

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