- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2019 08:29 PM
My requirement is that if at any approver rejects the Change Request, the state should become 'Closed' instead of 'New'. I tried it using workflow but not able to achieved.............
if an approver rejects the change request it should be closed with a comment because of approvers rejection it is closed
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2019 04:45 AM
Hi,
Here is how you can do this. I checked in my PDI and its working fine.
After reject notification, in your WF, add run script activity.
In run script, add the following code.
current.setWorkflow(false); //This will disable the BR that is restring the state move.
current.close_notes = "rejected";
current.close_code = "unsuccessful";
current.state = 3;
Connect Reject notification -> Run script -> End.
Mark the comment as a correct answer and also helpful once worked.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2019 09:25 PM
In an OOB instance, some restrictions are applied on the state transitions on change_request records. Check under state management>state.
https://docs.servicenow.com/bundle/newyork-it-service-management/page/product/change-management/concept/c_ChangeStateModel.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2019 10:52 PM
can you please help me with this BR : State Module-Can change state
if i disabled this it goes to closed after rejection but this will affect other implications or not.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2019 10:57 PM
Hi,
Kindly share the BR and we can place a condition to run only for your CRs and not to others.
Is there any pattern to identify/separate your created CRs from other CRs. (ex: assignment group, or category or anything)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2019 11:05 PM
hi asifnoor
actually this one is pre-defined br so making any changes to it will affect other things or not?
table is change_request
when to run before update
condition: state changes
advanced script:
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);
}
if approver reject this then state should be closed closed code-unsuccessful and close notes should be due to approvers rejection chgq req closed.