Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Schedule button missing in SOW for new change model

Jessica18
Tera Expert

I have created a new change model which has the following states: New, Scheduled, Implement, Review, Closed, Canceled. I have a state transition for "New to Scheduled."

 

I have also created a type = Model, when the change model is selected, the type value could be set to Model or null.

 

I need the "Schedule" ui action to display in Classic UI and Service Operations Workspace when the state is New. The out of the box condition "gs.hasRole('itil,sn_change_write') && new ChangeFormUI(current).isScheduleAvailable()" only works if the type = standard. I do not want to set the type=standard for my change model.

 

When I try to update the condition to this, as an example: "gs.hasRole('itil,sn_change_write') && new ChangeRequest(current).canMoveTo('-2')", the UI Action will display in the classic UI, but not SOW. I am generating this message "[ChangeRequestStateHandler]: _deriveModel: undefined type not specified. Using the ChangeRequestStateModel_normal script include."

 

I can't be the first person to have the requirement to have the "schedule" button display in a "new" state for a new change model. Does anyone have any suggestions or a solution?

Thank you.

1 ACCEPTED SOLUTION

Kieran Anson
Kilo Patron

Hi,

I imagine this is an oversight by ServiceNow given the adoption of models. If you haven't already, I'd suggest making Now Support aware.

 

To fix your issue, I'd amend the ChangeFormUI script include to override the behaviour which is the intended area to customise

var ChangeFormUI = Class.create();
ChangeFormUI.prototype = Object.extendsObject(ChangeFormUISNC, {
    initialize: function(_currChgGr, _gs) {
        ChangeFormUISNC.prototype.initialize.call(this, _currChgGr, _gs);
    },

    //override OOTB behaviour for our use case
    isScheduleAvailable: function() {
        //implement OOTB behaviour
        if (this._gr.type == "standard")
            return ChangeFormUISNC.prototype.isScheduleAvailable.call(this);

		//add support for models
        if (this._gr.tpye == 'model')
            return new ChangeRequest(changeGr).isNextManualState("-2");
    },

    type: 'ChangeFormUI'
});

View solution in original post

1 REPLY 1

Kieran Anson
Kilo Patron

Hi,

I imagine this is an oversight by ServiceNow given the adoption of models. If you haven't already, I'd suggest making Now Support aware.

 

To fix your issue, I'd amend the ChangeFormUI script include to override the behaviour which is the intended area to customise

var ChangeFormUI = Class.create();
ChangeFormUI.prototype = Object.extendsObject(ChangeFormUISNC, {
    initialize: function(_currChgGr, _gs) {
        ChangeFormUISNC.prototype.initialize.call(this, _currChgGr, _gs);
    },

    //override OOTB behaviour for our use case
    isScheduleAvailable: function() {
        //implement OOTB behaviour
        if (this._gr.type == "standard")
            return ChangeFormUISNC.prototype.isScheduleAvailable.call(this);

		//add support for models
        if (this._gr.tpye == 'model')
            return new ChangeRequest(changeGr).isNextManualState("-2");
    },

    type: 'ChangeFormUI'
});