Having issues adding new Change Request State

Andy Foster
Tera Contributor

Trying to add additional "Pre Assess" Change State as described in Add a state to the state model (https://docs.servicenow.com/bundle/vancouver-it-service-management/page/product/change-management/ta...) but I cannot get the "Pre Assess" state to appear in the states list when change state is New, and also a Pre Assess UI Action button to appear at same time.

I think one of the issues maybe in part down where any new this.toPreAssess_moving or this.toPreAssess_canMove functions need to be held.

2 REPLIES 2

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Andy Foster 

 

Assuming you follow the link line by line. Could you please provide screen shot of new state, also did you added those state and mapped to change table and what condition you wrote on UI action. 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Andy Foster
Tera Contributor
SCRIPT INCLUDE: ChangeRequestStateHandler
 
var ChangeRequestStateHandler = Class.create();
 
// All references to statehandler constants should be through this class ChangeRequestStateHandler
ChangeRequestStateHandler.DRAFT = ChangeRequestStateHandlerSNC.DRAFT;
ChangeRequestStateHandler.PREASSESS = "preassess";;
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, {
    initialize: function(changeRequestGr) {
        ChangeRequestStateHandlerSNC.prototype.initialize.call(this, changeRequestGr);
this.STATE_NAMES["1"] = ChangeRequestStateHandler.PREASSESS;
    },
 
    type: "ChangeRequestStateHandler"
});
 
=======================
SCRIPT INCLUDE: ChangeRequestStateModel_normal
 
 
var ChangeRequestStateModel_normal = Class.create();
ChangeRequestStateModel_normal.prototype = Object.extendsObject(ChangeRequestStateModelSNC_normal, {
    draft: {
        nextState: [ "preassess" ],
 
        preassess: {
            moving: function() {
                return this.toPreAssess_moving();
            },
 
            canMove: function() {
                return this.toPreAssess_canMove();
            }
        },
 
        canceled: {
            moving: function() {
                return this.toCanceled_moving();
            },
 
            canMove: function() {
                return this.toCanceled_canMove();
            }
        }
    },
 
preassess: {
        nextState: [ "assess" ],
 
        assess: {
            moving: function() {
                return this.toAssess_moving();
            },
 
            canMove: function() {
                return this.toAssess_canMove();
            }
        },
 
        canceled: {
            moving: function() {
                return this.toCanceled_moving();
            },
 
            canMove: function() {
                return this.toCanceled_canMove();
            }
        }
    },
 
    assess: {
        nextState: [ "authorize" ],
 
        draft: {
            moving: function() {
                return this.toDraft_moving();
            },
 
            canMove: function() {
                return this.toDraft_canMove();
            }
        },
 
        authorize: {
            moving: function() {
                return this.toAuthorize_moving();
            },
 
            canMove: function() {
                return this.toAuthorize_canMove();
            }
        },
 
        scheduled: {
            moving: function() {
                return this.toScheduled_moving();
            },
 
            canMove: function() {
                return this.toScheduled_canMove();
            }
        },
 
        canceled: {
            moving: function() {
                return this.toCanceled_moving();
            },
 
            canMove: function() {
                return this.toCanceled_canMove();
            }
        }
    },
 
    authorize: {
        nextState: [ "scheduled" ],
 
        draft: {
            moving: function() {
                return this.toDraft_moving();
            },
 
            canMove: function() {
                return this.toDraft_canMove();
            }
        },
 
        scheduled: {
            moving: function() {
                return this.toScheduled_moving();
            },
 
            canMove: function() {
                return this.toScheduled_canMove();
            }
        },
 
        canceled: {
            moving: function() {
                return this.toCanceled_moving();
            },
 
            canMove: function() {
                return this.toCanceled_canMove();
            }
        }
    },
 
    scheduled: {
        nextState: [ "implement" ],
 
        implement: {
            moving: function() {
                return this.toImplement_moving();
            },
            canMove: function() {
                return this.toImplement_canMove();
            }
        },
 
        canceled: {
            moving: function() {
                return this.toCanceled_moving();
            },
 
            canMove: function() {
                return this.toCanceled_canMove();
            }
        }
    },
 
    implement: {
        nextState: [ "review" ],
 
        review: {
            moving: function() {
                return this.toReview_moving();
            },
 
            canMove: function() {
                return this.toReview_canMove();
            }
        },
 
        canceled: {
            moving: function() {
                return this.toCanceled_moving();
            },
 
            canMove: function() {
                return this.toCanceled_canMove();
            }
        }
    },
 
    review: {
        nextState: [ "closed" ],
 
        closed: {
            moving: function() {
                return this.toClosed_moving();
            },
 
            canMove: function() {
                return this.toClosed_canMove();
            }
        }
    },
 
    closed: {},
 
    canceled: {},
 
    type: "ChangeRequestStateModel_normal"
});