- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-21-2021 08:11 AM
Good morning, I need to create a Business rule that prevents incidents to be changed to the "Resolved" state if their previous state was not "In Progress".
In the filter condition I have ticket the Update box, and set "State" with "Changes to" "Resolved". But I would need some help on the code to put in the Advanced tab, could someone please assist with this? Thanks in advance!
Solved! Go to Solution.
- Labels:
-
Instance Configuration
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-21-2021 08:55 AM
You may use below script to stop update to resolved , if state is anything other than WIP.
(function executeRule(current, previous /*null when async*/) {
if (!(previous.state) || previous.state != 2)
{gs.addInfoMessage("Incident can be resolved only if current state is WIP");
current.setAbortAction(true);}
// Add your code here
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-21-2021 08:21 AM
you can use filter- State Changes FROM In Progress & State Changes to Resolved dont believe advanced is necessary here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-21-2021 08:55 AM
You may use below script to stop update to resolved , if state is anything other than WIP.
(function executeRule(current, previous /*null when async*/) {
if (!(previous.state) || previous.state != 2)
{gs.addInfoMessage("Incident can be resolved only if current state is WIP");
current.setAbortAction(true);}
// Add your code here
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-21-2021 11:28 AM
Thank you very much, it worked like charm!