- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2024 06:51 PM
I'm trying to write a business rule that prevents an incident from being proposed as a major incident if the user lacks MIM roles, but it's not aborting the proposal. This is my condition and code:
(function executeRule(current, previous /*null when async*/) {
var user = gs.getUser();
if (!user.hasRole('incident_manager') || !user.hasRole('major_incident_manager')) {
gs.addErrorMessage('If you are proposing a Major Incident, you are required to engage the Major Incident Management (MIM) team by PHONE CALL. Contact details and Escalation Matrix can be found in the Enterprise Service Management Policy and Procedures Manual (ESM PPM).');
current.setAbortAction(true);
}
})(current, previous);
The error message is appearing, but the incident is still getting proposed as a MIM candidate.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2024 11:31 PM
Hi @Abbottronix , as @Runjay Patel suggested the State will not be updated as Proposed as it will throw Invalid update error. The State Choice list changes to Proposed in the client-side alone, it is not updated in the server-side. If you could Reload form , you can find that the state is not updated.
If you find this helpful, please mark as Correct or Helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2024 10:16 PM
Hi @Abbottronix ,
You mean incident state is getting saved as Proposed although error message appearing?
if you are getting error message then state will not set to proposed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2024 10:40 PM
Hello @Abbottronix
If you are using a negative condition, then it should be && instead of ||
Can you try by changing once?
Please mark the answer as helpful and correct if helped.
Kind regards,
Ravi Chandra
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2024 11:31 PM
Hi @Abbottronix , as @Runjay Patel suggested the State will not be updated as Proposed as it will throw Invalid update error. The State Choice list changes to Proposed in the client-side alone, it is not updated in the server-side. If you could Reload form , you can find that the state is not updated.
If you find this helpful, please mark as Correct or Helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2024 06:43 PM
You're right, that's what was happening. Is there anyway to make it reload from a business rule so that users won't get confused?