- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2023 04:58 AM
Hello Team,
I want to hide particular RITMs created from the specific catalog item using the Query Business rule for all users and it shows visible to only specific Groups
I created a Business rule But it's not working as expected, Still, non-specified group members see that RITM
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2023 06:22 AM - edited 05-03-2023 06:23 AM
Try this
(function executeRule(current, previous /*null when async*/ ) {
if (!(gs.getUser().isMemberOf('7547606d879e4d1080bba8a90cbb3595') || gs.getUser().isMemberOf('2dd2fa7f87922d50a4a486e40cbb3589'))) {
current.addEncodedQuery('cat_item!=858476ff87922d50a4a486e40cbb3571');
}
})(current, previous);
Also, once you get the script working, try to avoid the hardcoded sys_id
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2023 05:13 AM
Hello @Aparna Gurav ,
Are you providing the groups name which have access or the groups who don't have access.
Check your if condition , use gs.info() to log the information and check whether your condition working or not.
If this solves your query mark this as correct.
Regards
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2023 05:39 AM
@Community Alums : Thanks for the Response.
If the user is not a member of these groups, they will not have access to view the requested item in the catalog.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2023 05:16 AM
Hello Aparna,
Remove the filter condition Item is from when to run tab.
Change the code like below in your script.
if(gs.getUser().isMemberOf('sys_id of group1') || gs.getUser().isMemberOf('sys_id of group2'))
{
current.addQuery('cat_item','sys_id of catalog item);
}
Please mark my answer as helpful/correct if it helps you.
Regards,
Devender
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2023 05:37 AM
@Devender Kumar : I adjusted my script, But It's not working as expected
I want If the user does not belong to these groups then they can not see the requested item for that catalog item
Is any still adjustment required?
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
if (!gs.getUser().isMemberOf('7547606d879e4d1080bba8a90cbb3595') || !gs.getUser().isMemberOf('2dd2fa7f87922d50a4a486e40cbb3589')) {
current.addEncodedQuery('cat_item!=858476ff87922d50a4a486e40cbb3571');
}
})(current, previous);