Change Request - Revert to New UI from Authorize
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2023 08:57 PM
Hello,
I'm trying to get the Revert to New UI functioning from the Authorize state in Change Request management.
I can get the UI to appear in the Authorize state using a script include to assess the condition as follows:
gs.hasRole("itil,sn_change_write") && ((current.type == ChangeRequest.EMERGENCY && new ChangeRequest(current).isAuthorize()) || (current.type == ChangeRequest.NORMAL && new ChangeRequest(current).isAssess()) || (current.type == ChangeRequest.NORMAL && new ChangeRequest(current).isAuthorize()))
When I go to 'Revert to New' I get the following message:
gs.getMessage('State Model for {0} changes does not allow reverting change from {1} state', [changeRequest.getValue('type')
I have looked at the following script include to see if I can modify the state model changes but with no luck:
ChangeRequestStateModel_normal
This is in my personal lab environment so I'm using the OOB workflows etc.
I have looked at the ServiceNow documentation and other community posts but I haven't had much luck. The ServiceNow documentation is pointing towards modifying the ChangeRequestStateModel_normal script include but I haven't been able to get this to function.
Thanks,
Richo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2023 09:07 PM
@Richo1 - Are you using state model or you are using the traditional Change type? also Please let us know the change that you tried in the script include ChangeRequestStateModel_normal.
Thanks & Regards,
Vasanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2023 12:10 PM
Hi @Vasantharajan N ,
I'm just using the normal change OOB in my personal dev environment on Tokyo.
I had a look at the ChangeRequestStateModel_normal script include to see if I could change this to be able to revert back to New from the Authorize state, I have included a screen shot of how this script looks OOB with authorize: showing 'return this.todraft_moving();'
I have replaced the condition in the 'Revert to New' UI action with a script include, which performs the condition check and this is functioning correctly.
I have included a screen shot of the error I'm getting from the 'Revert to New' UI action.
I hope this is enough information.
Thanks,
Richard.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2023 11:35 PM
@Richo1 - Please add the state inside the nextState key as shown in the screenshot below and try. It will allow you to move the change from Authorize to "Scheduled" or "New". Please check.
Thanks & Regards,
Vasanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2023 03:35 PM
Hi @Vasantharajan N I have tested adding the state 'draft' into the nextState key under Authorize as shown in the screen shot but I'm still getting the same error:
'State Model for normal changes does not allow reverting change from Authorize state'
Thanks,
Richo