Need to set visibility of Catalog Item for specific group and user

SNOW46
Tera Contributor

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

18 REPLIES 18

Hi,

Please use before query Business rule on both tables:

find_real_file.png

 

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

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

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

Yes, You don't need ACL, Before Query BR is an alternative to ACL.

Note: Please use before Query BR

 

 

Thanks, 

Anil Lande

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

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

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

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande