- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2017 01:13 AM
Hi everyone, cameronrichard ctomasi
I am working on the state transition of my Normal Change model, and am facing this issue.
When I modify the script includes ChangeRequestStateHandler and ChangeRequestStateModel_normal, I see all the UI actions visible on the form, and the state field shows all transition states.
these UI actions are visible as form buttons and list button,
What did I do wrong?
Script of 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.BUILD = "build";
ChangeRequestStateHandler.SCHEDULED = ChangeRequestStateHandlerSNC.SCHEDULED;
ChangeRequestStateHandler.AUTHORIZE = ChangeRequestStateHandlerSNC.AUTHORIZE;
ChangeRequestStateHandler.IMPLEMENT = ChangeRequestStateHandlerSNC.IMPLEMENT;
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["-6"] = ChangeRequestStateHandler.BUILD;
},
type: "ChangeRequestStateHandler"
});
Script of ChangeRequestStateModel_normal
/*
STATE_NAMES: {
"-5": "draft",
"-4": "assess",
"-6": "build",
"-2": "scheduled",
"-3": "authorize",
"-1": "implement",
"0": "review", \\ not a used state
"3": "closed",
"4": "canceled",
}
*/
var ChangeRequestStateModel_normal = Class.create();
ChangeRequestStateModel_normal.prototype = Object.extendsObject(ChangeRequestStateModelSNC_normal, {
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: [ "build" ],
draft: {//if technical approver requests more information
moving: function() {
return this.toDraft_moving();
},
canMove: function() {
return this.toDraft_canMove();
}
},
build: {
moving: function() {
return this.toBuild_moving();
},
canMove: function() {
if(this._gr.getValue("u_needs_build")=="Yes") return true;
return false;
}
},
scheduled: {
moving: function() {
return this.toScheduled_moving();
},
canMove: function() {
if(this._gr.getValue("u_needs_build")=="No") return true;
return false;
}
},
canceled: {
moving: function() {
return this.toCanceled_moving();
},
canMove: function() {
return this.toCanceled_canMove();
}
}
},
build: {
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: [ "authorize" ],
authorize: {
moving: function() {
return this.toAuthorize_moving();
},
canMove: function() {
return this.toAuthorize_canMove();
}
},
canceled: {
moving: function() {
return this.toCanceled_moving();
},
canMove: function() {
return this.toCanceled_canMove();
}
}
},
authorize: {
nextState: [ "implement" ],
scheduled: {//if on hold
moving: function() {
return this.toScheduled_moving();
},
canMove: function() {
return this.toScheduled_canMove();
}
},
implement: {
moving: function() {
return this.toImplement_moving();
},
canMove: function() {
return this.toImplement_canMove();
}
},
closed: {//if rejected
moving: function() {
return this.toClose_moving();
},
canMove: function() {
return this.toClose_canMove();
}
},
canceled: {
moving: function() {
return this.toCanceled_moving();
},
canMove: function() {
return this.toCanceled_canMove();
}
}
},
implement: {
nextState: [ "closed" ],
authorize: {//if put on hold
moving: function() {
return this.toAuthorize_moving();
},
canMove: function() {
return this.toAuthorize_canMove();
}
},
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: {},
toBuild_moving: function() {
return true;
},
toBuild_canMove: function() {
return true;
},
type: "ChangeRequestStateModel_normal"
});
Solved! Go to Solution.
- Labels:
-
Change Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2017 07:45 AM
there is a typo in the code of ChangeRequestStateHandler:
ChangeRequestStateHandlerSNC.prototype.initialize.call(this, changeRequestGr);
This.STATE_NAMES["-6"] = ChangeRequestStateHandler.BUILD;
},
because of this capital T in this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2017 03:19 AM
the Flow Formatter is just a UI component that reacts to the value of the {state} field. It highlight a box, and ticks all preceding boxes.
I would think my issue is with the script includes, or the fact that the {state} field is not filtered based on the current state the change is in. Normally if you are in DRAFT the {state} field should have only ASSESS as value, but it shows all values. What is restricting the possible values of the {state} field.
Hope I am not confusing you more!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2017 03:24 AM
Hello Mbaye,
The script looks ok! To confirm, you've added new states for Normal changes...you've not added a new Change Type have you?
All the UI Actions show up when calls like this one fail:
ChangeRequestStateHandler(current).isNext("authorize")
I'm just putting a script together that will check if your config is correct.
I'll post once I'm done!
Thanks,
Cameron
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2017 03:30 AM
Sorry Cameron I did indeed add a new Change type, but set is as inactive. Should I remove it?
I will need at some point to add that new type of change (Latent Change) to allow to record change after the fact, and record that they were implemented without the CAB's awareness.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2017 07:53 AM
Hey Mbaye,
Can you change the upper case T in the line bellow to a lower case t:
ChangeRequestStateHandlerSNC.prototype.initialize.call(this, changeRequestGr);
This.STATE_NAMES["-6"] = ChangeRequestStateHandler.BUILD;
},
The This is incorrect, it should be this.
Give that a try and let me know please.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2017 07:45 AM
there is a typo in the code of ChangeRequestStateHandler:
ChangeRequestStateHandlerSNC.prototype.initialize.call(this, changeRequestGr);
This.STATE_NAMES["-6"] = ChangeRequestStateHandler.BUILD;
},
because of this capital T in this.