Need to set visibility of Catalog Item for specific group and user
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2021 05:16 AM
Hello All,
There is one Catalog Item configured which is available on Service Portal. I want to hide it from other users except for some groups and users. Those users who will create that Catalog Item can see the RITM and for others the REQ and RITM will not be visible.
Can anyone help me out on this.
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2021 05:41 AM
Hi,
Please use before query Business rule on both tables:
Here is your script:
(function executeRule(current, previous /*null when async*/ ) {
var u = gs.getUserID();
if (!gs.getUser().isMemberOf('CAB Approval') && gs.getSession().isInteractive()) { //replace group name
current.addEncodedQuery('cat_item!=sys_id_of_your_item^ORopened_byDYNAMIC90d1921e5f510100a9ad2572f2b477fe'); //replace sys_id of your catlog item
}
})(current, previous);
Apply this BR on RITM. Also use same logic for sc_request table and use proper encoded query based on sc_request table fields.
Thanks,
Anil Lande
Thanks
Anil Lande
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2021 06:26 AM
Hi Anil,
I don't need to configure any ACL's for this only I need to cofigure the BR for both the tables.
Please confirm on the same.
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2021 07:24 AM
Yes, You don't need ACL, Before Query BR is an alternative to ACL.
Note: Please use before Query BR
Thanks,
Anil Lande
Thanks
Anil Lande
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2021 08:04 AM
Hi Anil,
I have one more query here if I want to add multiple groups at a time how to modify the script? And in Before query shall I need to check Insert or Update?
And what abt Action Tab?
If u can guide me here it would be great..
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2021 01:08 AM
Hi,
Before query BR execute every time you make query to particular table, like open incident list, ritm list etc. Or you write a GlideRecord query to read data from table.
Before Query execute before your query is submitted to database and it add additinal conditions as per logic you put in BR. YOu don't need to check update/insert.
When to run should be before and check 'query' checkbox. This will be available when you check advance checkbox.
If you want to add additional groups to see records you can update filter condition :
if (!(gs.getUser().isMemberOf('CAB Approval')||gs.getUser().isMemberOf('Another group name')) && gs.getSession().isInteractive()) { //replace group name
current.addEncodedQuery('cat_item!=sys_id_of_your_item^ORopened_byDYNAMIC90d1921e5f510100a9ad2572f2b477fe'); //replace sys_id of your catlog item
}
You can add multiple groups by adding ||gs.getUser().isMemberOf('groupName') in above statement like I have added one for reference.
Thanks,
Anil Lande
Thanks
Anil Lande