- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2018 10:08 PM
Hi all,
I created a new change type (minor) using this tutorial, and then used this tutorial to add my own states.
The States I have added for this test is:
- Develop and Implement in UAT (8)
- Test in UAT (12)
The issue I am having is that when I go to the change, When it is at New, the new state of 'Develop and Implement in UAT' is not available.
It is probably worth noting that the change request here was heavily modified by the implementer, and the OOB states (Draft, Assess etc) have been removed as part of the implementation before my time.
Below are the two script includes edited as per the tutorial. Any clues where I am going wrong?
Thanks in Advance!
ChangeRequestStateHandler
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.DEVELOP_AND_IMPLEMENT_IN_UAT = "develop_and_implement_in_uat";
ChangeRequestStateHandler.TEST_IN_UAT = "test_in_uat";
ChangeRequestStateHandler.prototype = Object.extendsObject(ChangeRequestStateHandlerSNC, {
MINOR:"minorv2",
initialize: function(changeRequestGr) {
ChangeRequestStateHandlerSNC.prototype.initialize.call(this, changeRequestGr);
this.STATE_NAMES["8"] = ChangeRequestStateHandler.DEVELOP_AND_IMPLEMENT_IN_UAT;
this.STATE_NAMES["12"] = ChangeRequestStateHandler.TEST_IN_UAT;
},
_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.MINOR)
this._model = new ChangeRequestStateModel_minor(this._gr);
},
type: "ChangeRequestStateHandler"
});
ChangeRequestStateModel_minor
var ChangeRequestStateModel_minor = Class.create();
ChangeRequestStateModel_normal.prototype = Object.extendsObject(ChangeRequestStateModelCust_minor, {
draft: {
nextState: [ "develop_and_implement_in_uat" ],
develop_and_implement_in_uat: {
moving: function() {
return this.toDevelopuat_moving();
},
canMove: function() {
return this.toDevelopuat_canMove();
}
},
canceled: {
moving: function() {
return this.toCanceled_moving();
},
canMove: function() {
return this.toCanceled_canMove();
}
}
},
develop_and_implement_in_uat: {
nextState: [ "test_in_uat" ],
test_in_uat: {
moving: function() {
return this.toTestuat_moving();
},
canMove: function() {
return this.toTestuat_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();
}
},
canceled: {
moving: function() {
return this.toCanceled_moving();
},
canMove: function() {
return this.toCanceled_canMove();
}
}
},
closed: {},
canceled: {},
toDevelopuat_moving: function() {
return true;
},
toDevelopuat_canMove: function() {
return true;
},
toTestuat_moving: function() {
return true;
},
toTestuat_canMove: function() {
return true;
},
type: "ChangeRequestStateModel_minor"
});
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2018 12:07 AM
You can try to add new STATE_NAMES on ChangeRequestStateHandler
this.STATE_NAMES["1"] = ChangeRequestStateHandler.DRAFT;
Then try again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2018 09:19 PM
Hi Brendan,
Could you post your script ChangeRequestStateModelCust_minor ?
Maybe issue at this class.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2018 09:25 PM
Hey,
Here is the ChangeRequestStateModelCust_minor script
var ChangeRequestStateModelCust_minor = Class.create();
ChangeRequestStateModelCust_minor.prototype = {
initialize: function(changeRequestGr) {
this._gr = changeRequestGr;
},
toDraft_moving: function() {
return true;
},
toDraft_canMove: function() {
return true;
},
toAssess_moving: function() {
return true;
},
toAssess_canMove: function() {
return true;
},
toAuthorize_moving: function() {
return true;
},
toAuthorize_canMove: function() {
return true;
},
toScheduled_moving: function() {
return true;
},
toScheduled_canMove: function() {
return true;
},
toImplement_moving: function() {
if (this._gr.work_start.nil())
this._gr.work_start = new GlideDateTime();
return true;
},
toImplement_canMove: function() {
return true;
},
toReview_moving: function() {
if (this._gr.work_end.nil())
this._gr.work_end = new GlideDateTime();
return true;
},
toReview_canMove: function() {
return true;
},
toClosed_moving: function() {
return true;
},
toClosed_canMove: function() {
return true;
},
toCanceled_moving: function() {
this._gr.on_hold = false;
return true;
},
toCanceled_canMove: function() {
return true;
},
isOnHold: function() {
return this._gr.on_hold;
},
type: 'ChangeRequestStateModelCust_minor'
};
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2018 09:33 PM
You try edit ChangeRequestStateModel_minor as below:
var ChangeRequestStateModel_minor = Class.create();
ChangeRequestStateModel_minor.prototype = Object.extendsObject(ChangeRequestStateModelCust_minor, {
draft: {
nextState: [ "develop_and_implement_in_uat" ],
develop_and_implement_in_uat: {
moving: function() {
/*@Jack(03-03-2018): Class ChangeRequestStateModelCust_minor has not defined method toDevelopuat_moving();
return this.toDevelopuat_moving();
*/
return true;
},
canMove: function() {
/*@Jack(03-03-2018): Class ChangeRequestStateModelCust_minor has not defined method toDevelopuat_canMove();
return this.toDevelopuat_moving();
*/
return true;
}
},
canceled: {
moving: function() {
return this.toCanceled_moving();
},
canMove: function() {
return this.toCanceled_canMove();
}
}
},
develop_and_implement_in_uat: {
nextState: [ "test_in_uat" ],
test_in_uat: {
moving: function() {
/*@Jack(03-03-2018): Class ChangeRequestStateModelCust_minor has not defined method toTestuat_moving();
return this.toTestuat_moving();
*/
return true;
},
canMove: function() {
/*@Jack(03-03-2018): Class ChangeRequestStateModelCust_minor has not defined method toTestuat_canMove();
return this.toTestuat_canMove();
*/
return this.toTestuat_canMove();
}
},
canceled: {
moving: function() {
return this.toCanceled_moving();
},
canMove: function() {
return this.toCanceled_canMove();
}
}
},
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2018 09:57 PM
Hey,
I have changed the ChangeRequestStateModel_minor script, however, there was no change.
The edits that you have made (the functions) are actually at the bottom of the hangeRequestStateModel_minor script, unless I am mistaken?
ChangeRequestStateModel_minor.prototype = Object.extendsObject(ChangeRequestStateModelCust_minor, {
draft: {
nextState: [ "develop_and_implement_in_uat" ],
develop_and_implement_in_uat: {
moving: function() {
return this.toDevelopuat_moving();
},
canMove: function() {
return this.toDevelopuat_canMove();
}
},
canceled: {
moving: function() {
return this.toCanceled_moving();
},
canMove: function() {
return this.toCanceled_canMove();
}
}
},
develop_and_implement_in_uat: {
nextState: [ "test_in_uat" ],
test_in_uat: {
moving: function() {
return this.toTestuat_moving();
},
canMove: function() {
return this.toTestuat_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();
}
},
canceled: {
moving: function() {
return this.toCanceled_moving();
},
canMove: function() {
return this.toCanceled_canMove();
}
}
},
closed: {},
canceled: {},
toDevelopuat_moving: function() {
return true;
},
toDevelopuat_canMove: function() {
return true;
},
toTestuat_moving: function() {
return true;
},
toTestuat_canMove: function() {
return true;
},
type: "ChangeRequestStateModel_minor"
});
Specifically
toDevelopuat_moving: function() {
return true;
},
toDevelopuat_canMove: function() {
return true;
},
toTestuat_moving: function() {
return true;
},
toTestuat_canMove: function() {
return true;
},
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2018 10:13 PM
Yes, you right. I didn't see it.
Could you try create new change with type 'minorv2' , state "New"? Then goto system log and check any error/warning/info related to ChageRequestStateModelHandler.
Honestly, I see class ChangeRequestStateHandler -> OK,
ChangeRequestStateModel_minor -> OK,
ChangeRequestStateModelCust_minor ->OK.
if you see any new log, just post here and we can help you.