How to limit the specific catalog item to only one department users even the requests raised by the
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2023 10:13 AM
How to limit the specific catalog item to only one department users even the requests also raised by the specific department only.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2023 01:51 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2023 02:13 AM
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);
}
Regards,Sushant Malsure
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2023 05:16 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2023 05:19 AM
then remove this condition in BR as : !gs.hasRole("admin") and keep it empty
Regards,Sushant Malsure
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2023 02:35 AM
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?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader