- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2018 03:19 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
- Test in UAT
What I have found is that when clicking State, the Option is there to choose all available states, instead of seeing just the next state available.
New should show Develop and Implement in UAT only.
I debugged with field watcher, and have found that the client script 'Show valid states values' is not running
In my personal development instance, the client script shows as running when using the field watcher. It is probably worth noting that the change request here was heavily modified by the implementer, however, I cannot see any of their scripts running on the state field with the field watcher so not sure something is cancelling it out, but rather something is wrong with the script includes that I have created for the new change type.
Below are the script inlcudes that I have created for the new change type. Can anyone see why the client script is not running?
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:Minor,
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_im_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-01-2018 07:05 PM
Hi Brendan,
I thinks you should be check:
1) The value of new type: "Minor" or "minor"
2) Update "ChangeRequestStateHandler" for new type:
MINOR: "<value of new type>",
=> I thinks you have a typo mistake when updating "ChangeRequestStateHandler"
Hope this help!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2018 08:09 PM
Hey,
So i went back to take a look, and what Jack suggested was correct. I forgot the quotation marks with MINOR:"minorv2".
Thanks so much for your help today, I have learnt a lot from the alerting and debugging you had me do.
Have a great weekend!
Brendan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2018 07:05 PM
Hi Brendan,
I thinks you should be check:
1) The value of new type: "Minor" or "minor"
2) Update "ChangeRequestStateHandler" for new type:
MINOR: "<value of new type>",
=> I thinks you have a typo mistake when updating "ChangeRequestStateHandler"
Hope this help!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2018 07:33 PM
Hi,
Thanks for this finding this.
it should actually be minorv2, as that is the value of the new change type.
I did change this and it still is not working. I have 3 logs that i found, it is in the thread with sanjivmeher
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2018 08:07 PM
Hey Jack,
Just reread your post, and I missed the quotation marks!
I have added them in and the client script is running 🙂
Cheers mate!