(Vancouver) Added new change type, Expedited, does not work well with the UI Action 'Revert to New'

olufsen
Kilo Sage

I have followed the steps on this document, however it doesn't work well whenever I use the Revert to New UI action. Please kindly help.

UI Action updated condition

gs.hasRole("itil,sn_change_write") && ((current.type == ChangeRequest.EMERGENCY && new ChangeRequest(current).isAuthorize()) || (current.type == ChangeRequest.NORMAL && new ChangeRequest(current).isAssess()) || (current.type == "expedited" && new ChangeRequest(current).isAssess()))

 

On step #5 configuring the script include for the state handler, I implemented as such. However, this does not reverted the workflow to start/new, it just updated the state back to New.

 

 

var ChangeRequestStateHandler = Class.create();

// All references to statehandler constants should be through this class ChangeRequestStateHandler
ChangeRequestStateHandler.DRAFT = ChangeRequestStateHandlerSNC.DRAFT;
ChangeRequestStateHandler.ASSESS = ChangeRequestStateHandlerSNC.ASSESS;
ChangeRequestStateHandler.AUTHORIZE = ChangeRequestStateHandlerSNC.AUTHORIZE;
ChangeRequestStateHandler.SCHEDULED = ChangeRequestStateHandlerSNC.SCHEDULED;
ChangeRequestStateHandler.IMPLEMENT = ChangeRequestStateHandlerSNC.IMPLEMENT;
ChangeRequestStateHandler.REVIEW = ChangeRequestStateHandlerSNC.REVIEW;
ChangeRequestStateHandler.CLOSED = ChangeRequestStateHandlerSNC.CLOSED;
ChangeRequestStateHandler.CANCELED = ChangeRequestStateHandlerSNC.CANCELED;

ChangeRequestStateHandler.prototype = Object.extendsObject(ChangeRequestStateHandlerSNC, {

    //Added as per documentation
    EXPEDITED: "expedited",

    initialize: function(changeRequestGr) {
        ChangeRequestStateHandlerSNC.prototype.initialize.call(this, changeRequestGr);
    },

     //Added as per documentation
    _resetModel: function() {
        this._model = null;
        var type = this._gr.getValue('type') + "";
        if (type == this.NORMAL || type == this.STANDARD || type == this.EMERGENCY)
            ChangeRequestStateHandlerSNC.prototype._resetModel.call(this);
        else if (type == this.EXPEDITED)
            this._model = new ChangeRequestStateModel_expedited(this._gr);
    },
    type: "ChangeRequestStateHandler"
});

 

The workflow after clicking the Revert to New

olufsen_0-1730239316355.png

Approvers were cancelled

olufsen_1-1730239354155.png

 

0 REPLIES 0