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.

modifying standard change stages. Help please

RBlor
Mega Guru

Hello! i am modifying the out of the box standard change and i would like to add an Assess stage.I checked with NOW support and they said to modify the script include: ChangeRequestStateModel_standard

I did so  as well as modifying the workflow to add an "moves to assess" state.

find_real_file.png

 

 

The script i changed. to add the assess stage doesnt seem to help i cant get to scheduled after the assess stage:

 

the script include is below:

 

var ChangeRequestStateModel_standard = Class.create();
ChangeRequestStateModel_standard.prototype = Object.extendsObject(ChangeRequestStateModelSNC_standard, {
    draft: {
        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: [ "scheduled" ],

        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_standard"
});

 

do you have any suggestions on how to resolve this? Thank you for your time.

2 REPLIES 2

MrMuhammad
Giga Sage

Hi @RBlor 

Script looks good. How are you moving from assess to scheduled? By looking at the workflow it seems like it is a manual effort. Maybe a UI action? Can you share some details about that?

Regards,

Muhammad

Regards,
Muhammad

I thought I could just change the state from new to assess and then change the state to scheduled. I did notice there's no UI buttons for assess and scheduled currently, but before I did any modifications there was a scheduled ui button