login user has role "AB" can resolve the incident
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2024 11:06 PM
Hi All,
Seniors: if login user has a role "AB" have access to resolve the p1/p2 incidents.
i used BR - "Before Update" to get it done how ever its failing. any mistake in my script?
(function executeRule(current, previous /null when async/) {
if (current. role != 'AB')
{ if (current.state == '6')
{ current.state = previous.state; // Rollback state change current.setAbortAction(true); gs.addErrorMessage('AB Role user can resolve the incident');
} }
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2024 11:25 PM - edited 04-02-2024 11:28 PM
@nani1 You can configure business rule as below. Try to use condition builder as much as possible.
(function executeRule(current, previous /*null when async*/) {
if (!gs.hasRole('AB'))
{
current.setAbortAction(true);
gs.addErrorMessage('only AB Role user can resolve the incident');
}
})(current, previous);
If I could help you with your Query then, please hit the Thumb Icon and mark as Correct !!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2024 11:36 PM
Hi @nani1 there are errors in your BR. to check roles you need to use gs.hasRole() method
and for state check you can add the condition in Business Rule
if (!gs.hasRole('AB'))
{
current.state = previous.state; // Rollback state change
current.setAbortAction(true);
gs.addErrorMessage('AB Role user can resolve the incident');
}
Harish