prevent change request closing without approvals
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-27-2016 02:56 PM
I am new to being an admin for ServiceNow. We have been having an issue where our users are closing their change request even though it has not gone through the whole approval process. I am trying to find a way to prevent this from happening with the tool.
Is there a way from preventing the users from updating their change "State" from "Pending or Open" to "Close Complete or Close Incomplete" if the "Approval" attribute is anything besides approved?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-28-2016 01:10 PM
Hi Mickey,
- Remove "current.setAbortaction(true);" from your Condition.
- Set your script to:
function onBefore(current, previous){
current.setAbortaction(true);
}
With that line commented, it won't do anything.
Also, try using "State changes to Completed" and "State changes to Failed" instead of equals (is) for your conditions.
-Brian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-28-2016 02:14 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-28-2016 03:27 PM
Hi Mickey,
Two things to correct:
- This first one is my fault, the script is case-sensitive and I made a typo in the method name. It should be (make sure both "A"s are capitalized):
current.setAbortAction(true); - And in your condition, make it:
Approvals is not Approved
AND ("State changes to Completed" OR "State changes to Failed")
Right now, you have it using only AND, which means all the conditions must be true at once.
-Brian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-28-2016 04:36 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-28-2016 04:45 PM
Hi Mickey,
You need to check the options for "Update" and "Insert", otherwise it doesn't have a "when" to apply the business rule.
Thanks,
-Brian