Restrict RITM and SCTASK Visibility based on RITM assignment group
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2024 09:55 PM
Hi,
I have a requirement to restrict the visibility if RITM and SCTASK based on the RITM assignment group for a particular catalog item, The RITM and SCTASK should be visible only to the RITM assignment group and approver group (RITM assignment group is auto populated from flow). I have tried before query BR but it's not working.
A Soultion would be helpful.
Before Query BR Script:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2024 04:54 AM
In a before Query Business Rule, current.field_name is not valid as there is no current record - it's building the list. You can accomplish your requirements with something more like this:
(function executeRule(current, previous /*null when async*/) {
var ritmArr = [];
var ritm = new GlideRecord('sc_req_item');
ritm.query();
while(ritm.next()) {
if (!(gs.getUser().isMemberOf(ritm.assignment_group) || gs.getUser().isMemberOf("sys_id of the approver group"))) {
if (ritm.cat_item != 'sys_id of the catalog item') {
ritmArr.push(ritm.sys_id.toString());
}
} else {
ritmArr.push(ritm.sys_id.toString());
}
}
current.addQuery('sys_id', 'IN', ritmArr.join(','));
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2024 05:49 AM
Hi @Shruthi8
Instead of query business rule, use ACL with conditions in the script section.
Please mark this correct/helpful if this answers your question.
Regards,
Shambhu