Custom Change state model problem
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2022 06:11 AM
Need some help please, I have been trying to get a custom state model/transition for the change module working, but have been unsuccessful.
The states appear in the change record BUT am unable to progress to that state. it errors with "Invalid Update" when I try to move it on from status of New (except for cancel which seems to work). Furthermore no errors in the log.
I have updated the script ChangeRequestStateHandler as follows:
var ChangeRequestStateHandler = Class.create();
// All references to statehandler constants should be through this class ChangeRequestStateHandler
ChangeRequestStateHandler.DRAFT = ChangeRequestStateHandlerSNC.DRAFT;
ChangeRequestStateHandler.AFI = "afi";
ChangeRequestStateHandler.REGISTER = "register";
//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["-10"] = ChangeRequestStateHandler.AFI;
this.STATE_NAMES["-21"] = ChangeRequestStateHandler.REGISTER;
},
type: "ChangeRequestStateHandler"
});
I have de-activated the ootb ChangeRequestStateModel_normal and created my own one of the same name:
var ChangeRequestStateModel_normal = Class.create();
ChangeRequestStateModel_normal.prototype = Object.extendsObject(ChangeRequestStateModelCUST_normal, {
draft: {
nextState: [ "afi", "register", "canceled" ],
afi: {
moving: function() {
return this.toAfi_moving();
},
canMove: function() {
return this.toAfi_canMove();
}
},
register: {
moving: function() {
return this.toRegister_moving();
},
canMove: function() {
return this.toRegister_canMove();
}
},
canceled: {
moving: function() {
return this.toCanceled_moving();
},
canMove: function() {
return this.toCanceled_canMove();
}
}
},
closed: {},
canceled: {},
type: "ChangeRequestStateModel_normal"
});
That file extends ChangeRequestStateModelCUST_normal
var ChangeRequestStateModelCUST_normal = Class.create();
ChangeRequestStateModelCUST_normal.prototype = {
initialize: function() {
},
toDraft_moving: function() {
return true;
},
toDraft_canMove: function() {
return true;
},
toRegister_moving: function() {
return true;
},
toRegister_canMove: function() {
return true;
},
toAfi_moving: function() {
return true;
},
toAfi_canMove: function() {
return true;
},
toCanceled_moving: function() {
this._gr.on_hold = false;
return true;
},
toCanceled_canMove: function() {
return true;
},
type: 'ChangeRequestStateModelCUST_normal'
};
I have checked the documentation and this should be work.
- Labels:
-
User Interface (UI)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2022 06:33 AM
Personally, I would add some gs.info() statements in various places in the code just to make sure that it's doing exactly what you expect.
Frank
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2022 06:43 AM
i think i found the problem, just verifying......