- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2017 01:09 AM
I added two states draft and work in progress as the process given in Add a state to the change state model
in my case the first step is draft and second state will be work in progress after that there are other states
i have to do in a way that from draft the state will only be updated to work in progress. After it comes to work in progress then it may go to another state for . this is emergency change request type
But i cannot understand how to edit the script include ChangeRequestStateModel_emergency.
Need help
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2017 12:59 AM
Hi Suprakash,
'Review' is a OOB Change request state, so you do not have to define 'canMove' or 'moving' function separately for review. In your case the code will below:
work_in_progress: {
nextState: [ "review" ],
review: {
moving: function() {
return this.toReview_moving();
},
canMove: function() {
return this.toReview_canMove();
}
},
I hope this helps.Please mark correct/helpful based on impact
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2017 05:05 AM
Hi Suprakash,
Thanks for sharing your findings. Let me have a deep look at this and get back to you both.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2017 05:13 AM
Thanks ,
will be waiting for your reply.......
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2017 12:20 AM
Now its working fine Amlan ,
Just to make the code more perfect and so that it may help others.
i am adding the line that i missed to add .
work_in_progress: {
nextState: [ "review" ],
review: {
moving: function() {
return this.toReview_moving();
},
canMove: function() {
return this.toReview_canMove();
}
},
review: {}, // without this the code will not work. use this if you donot want to permit any state from review.
or if you want to pass any state from it , then use the below code
for example:
review: {
nextState: [ "yourNextState" ],
yourNextState: {
moving: function() {
return this.toyournextstate_moving();
},
canMove: function() {
return this.toyournextstate_canMove();
}
},
},
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2021 04:41 AM
My requirement is to deactivate the OOB states and create new custom states.
if we use OOB BR("State model - Can change state?) and Script includes(ChangeRequestStateHandler & ChangeRequestStateHandlerSNC) ->In my case, getting an "invalid update" error when update the change state on form.
my edited script include is ChangeRequestStateHandler code is below:
var ChangeRequestStateHandler = Class.create();
ChangeRequestStateHandler.SUBMITTED = "submitted";
ChangeRequestStateHandler.VALIDATED = "validated";
ChangeRequestStateHandler.AUTHORIZED = "authorized";
ChangeRequestStateHandler.SCHEDULED = "scheduled";
ChangeRequestStateHandler.IMPLEMENTED = "implemented";
ChangeRequestStateHandler.FAILED = "failed";
ChangeRequestStateHandler.REJECTED = "rejected";
ChangeRequestStateHandler.CANCELLED = "cancelled";
ChangeRequestStateHandler.prototype = Object.extendsObject(ChangeRequestStateHandlerSNC, {
initialize: function(changeRequestGr) {
ChangeRequestStateHandlerSNC.prototype.initialize.call(this, changeRequestGr);
this.STATE_NAMES["1"] = ChangeRequestStateHandler.SUBMITTED;
this.STATE_NAMES["2"] = ChangeRequestStateHandler.VALIDATED;
this.STATE_NAMES["3"] = ChangeRequestStateHandler.AUTHORIZED;
this.STATE_NAMES["4"] = ChangeRequestStateHandler.SCHEDULED;
this.STATE_NAMES["5"] = ChangeRequestStateHandler.IMPLEMENTED;
this.STATE_NAMES["6"] = ChangeRequestStateHandler.FAILED;
this.STATE_NAMES["7"] = ChangeRequestStateHandler.REJECTED;
this.STATE_NAMES["8"] = ChangeRequestStateHandler.CANCELLED;
},
type: "ChangeRequestStateHandler"
});