State model - Can change state? business rule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2016 03:19 AM
There is a business rule called 'State model - Can change state?' which can be seen across ServiceNow platform since last April after the Geneva Patch 3 Hotfix 2 upgrade. This business rule runs for the change request table (Before-Insert). Do anyone knows what this business rule does? I can see that this rule is calling a script include ChangeRequestStateHandler which in turn calls another Read-Only script include ChangeRequestStateHandlerSNC but couldn't understand the logic.
Thanks in advance!!
function onBefore(current, previous) {
var stateHandler = new ChangeRequestStateHandler(current);
// Check if the change in state that has already occured is valid
if (!stateHandler.moveFrom(stateHandler.getStateName(previous.state)))
current.setAbortAction(true);
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-03-2016 05:09 AM
This business rule validates if the current state transition in Change Request is valid. If not then it aborts it.
For example, if for a normal Change if you are moving from Assess to Authorize state, then the following code will be invoked.
ChangeRequestStateModel_normal.assess.authorize.canMove();
which in-turn invokes:-
ChangeRequestStateModelSNC_normal.toAuthorize_canMove();
Which returns 'true' so it will go through.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-21-2017 01:39 PM
I've an issue where keeping this BR active, it makes my normal BR jump from assess to scheduled state. I undid changes made to ChangeRequestStateModel_normal but still seeing this issue. Any solution to this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-24-2023 01:09 AM
Hi Nirupam,
I have to close an CR from background script which is currently in 'Assess' State. But this BR is preventing me from doing so. Any suggestions on how to change the state of the CR?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-24-2023 01:51 AM
Hi Nirupam,
I have to close an CR from background script which is currently in 'Assess' State. But this BR is preventing me from doing so. Any suggestions on how to change the state of the CR?
Thanks in advance!