Is there a way to restrict RITM list view and related SCTASK (service catalog) tasks list views of a particular service catalog item to a group of users or based on role.

Kamran1
Kilo Guru

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

 

 

 

 

 

1 ACCEPTED SOLUTION

Kamran1
Kilo Guru

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);

View solution in original post

12 REPLIES 12

Kamran1
Kilo Guru

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. 

 

@SatheeshKumar, I will look at snguru post to see if I can play around with conditions.

 

Thanks

Cam

Kamran1
Kilo Guru

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

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

Regards
Harish

Hi you can just add a condition in existing read ACL. Below ACL users having role 'itil' cannot see the ritm records  for item APPLE ipad 3

find_real_file.png

Regards
Harish

weikiat_guaz
Giga Expert

You can try Business Rule with QUERY action: 

So that we can add your custom query condition whenever people query the table

find_real_file.png

 

find_real_file.png