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:17 AM
HI @Rajamouly ,
According to your script, you need to declear the variable "visible", so instead it should be:
(function executeRule(current, previous /*null when async*/) {
var visible = current.u_visible_to_hris_team;
if(visible == 'true') {
if(gs.getUser().isMemberOf('HRIS - Workday Support')) {
current.addQuery('assignment_group.name','HRIS - Workday Support');
}
else if (gs.getUser().isMemberOf('HRIS - iCIMS Support')){
current.addQuery('assignment_group.name','HRIS - iCIMS Support');
}
}
})(current, previous);
If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
best regards
Anders
If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.
Best regards
Anders
Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2023 03:28 AM
Hi @AndersBGS
I declared the variable (it was not copied previously), even after i tried it is not working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2023 03:18 AM
in query BR you don't have access to field value so you cannot determine if checkbox is checked or not
why not handle this using table 2 level READ ACL?
1 table level READ will be with Checkbox True condition
1 table level READ will be with Checkbox False condition
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 03:30 AM