Business Rule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
I am having a bit of difficulty drafting a group assignment blocking rule within a BR.
The rule should work as follows:
Only N2 groups should have permission to assign tickets to N3. IF an N3 group tries to assign tickets to other N3 groups, they should be blocked and shown a message directing them to N2. IF any other group tries to assign a ticket to an N3 group, the block, message, and redirection should be applied as well. The rule should only allow N2 groups to assign tickets to N3.
See the script below:
BR = Before - Update/Insert
];
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago - last edited 3 hours ago
Redirection requirement needs more clarity. redirects to which group?
Sample code/configuration could be
Navigate to System Definition > Business Rules and create a new rule.
Table: Incident [incident]
Advanced: Checked
When: Before (Insert and Update)
Condition: Assignment group | Changes to | [Sys_id of N3]
Script:
(function executeRule(current, previous /*null when async*/) {
// Check if user is NOT in N2
if (!gs.getUser().isMemberOf('<sys_id of N2>')) {
gs.addErrorMessage('Only members of N2 can assign to N3.');
current.setAbortAction(true);
}
})(current, previous);
