Before Query Business Rule is not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2023 03:11 AM
HI,
I am trying to restrict the incident records, when the user is tick on the check box 'Visible to HRIS team' and should be part of any of two assignment groups "HRIS - Workday Support" and "HRIS - iCIMS Support" .
Below is the Business Rule Written but it is not working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2023 03:37 AM
just with conditions it will work
Ensure you give correct conditions for both
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2023 05:00 AM
I crated a custom role 'HRIS_WD' same role i have assigned to two HRIS groups, created a new Read ACL on incident table with condition 'Visible to HRIS Team is True' and if i logged in with HRIS user and tick the check box true, same INC is visible to all other ITIL users.
Please advise anything i am missing?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2023 05:20 AM
your query BR and table level READ ACL should be in sync
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2023 05:48 AM
Sorry to trouble you again, i have enabled both BR and ACL but still no luck.
I removed the condition if(visible=='true') from BR, below is the BR script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2023 03:43 AM
HI @Rajamouly ,
I trust you are doing great.
Please refer below updated code:
(function executeRule(current, previous /*null when async*/) {
var visible = current.u_visible_to_hris_team;
if (visible === 'true') {
var assignmentGroup = current.assignment_group;
if (assignmentGroup.nil()) {
current.addQuery('assignment_group.nameIN', ['HRIS - Workday Support', 'HRIS - iCIMS Support']);
} else {
var assignmentGroupName = assignmentGroup.name.toString();
if (assignmentGroupName !== 'HRIS - Workday Support' && assignmentGroupName !== 'HRIS - iCIMS Support') {
current.addQuery('assignment_group.nameIN', ['HRIS - Workday Support', 'HRIS - iCIMS Support']);
}
}
}
})(current, previous);
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi