- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â07-26-2019 02:37 PM
We have a service catalog item ABC, that generates RITM/SCTASK as any other OOB SC item would do.
Is there a way to hide RITM/SCTASK lists created as a result of submitting a request via cat item ABC. In other words we would like to restrict a group of users to be able to see RITM and SCTASK created under catalog item ABC.
I have tried hiding variables with a role with an onload script which works but the small preview i icon still shows them as well as users can still see RITM list.
Any help would be greatly appreciated.
Thanks,
Cam
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â07-29-2019 09:22 AM
I got it working. Just had the && condition needed instead of ||
(function executeRule(current, previous /*null when async*/) {
if(gs.getUserID().hasRole('admin')!=true && gs.getUserID().hasRole('epic1')!=true) {
current.addQuery('cat_item.name','!=','Apple iPad 3');
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â07-28-2019 08:25 AM
Thank you all for your the replies. I have attached the RITM list and related SCTASK list view screenshots.
I was able to hide variables off the RITM and SCATSK using client script based on role condition. But it still shows on the preview when howering mouse over the i.
@Shillu, if we were to use ACL, is there any example you can share that allows to restrict based on conditions like user group, logged in user's role and particular item related tasks and ritms? I am not an expert in scripting. The challenge is that there are other 6 ACLs that we may have to touch in order to restrict based on ACL.
Thanks
Cam
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â07-28-2019 09:22 PM
Here is what my before BR:
(function executeRule(current, previous /*null when async*/) {
if(gs.getUserID().hasRole('admin')!=true || gs.getUserID().hasRole('epic1')!=true) {
current.addQuery('cat_item.name','!=','Apple iPad 3');
}
})(current, previous);
I have even tried without getUserID() or just using getUser(), but it is not hiding the RITMs based on role, it is just hiding the RITM for everyoe. Adding the epic1 role to user still keeps the item hidden. I have even tried with sys_id of the role to no avail. What am I missing?
Thanks,
Cam

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â07-28-2019 10:01 PM
Hi Try the below
(function executeRule(current, previous /*null when async*/) {
if(gs.hasRole("itil") && gs.isInteractive()) {
var u = gs.getUserID();
var qc = current.addQuery("cat_item.name", '!=','Apple iPad 3');
gs.print("query restricted to user: " + u); }
})(current, previous);
I am hiding this for user having role ITIL
Harish

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â07-28-2019 10:41 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â07-29-2019 12:07 AM