- 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-09-2017 10:37 PM
Sure Saptashwa.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2017 11:08 PM
Hello Amlan,
Would you please help me out?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2017 10:49 PM
Actually I dont want any of those OOTB states. I have created the states of my own. Now I want to implement the state model as per my states.
I have inactivated all the OOTB states for "Change Request" table.
I have commented out, all these piece of codes.
/*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;*/
I have modified the code as:
ChangeRequestStateHandlerNew.DRAFT = "Draft";
ChangeRequestStateHandlerNew.REVIEW = "Review"; // This is newly created not the OOTB "review state".
ChangeRequestStateHandlerNew.APPROVAL = "Approval";
ChangeRequestStateHandlerNew.WORK_IN_PROGRESS = "Work in Progress";
ChangeRequestStateHandlerNew.CLOSED_COMPLETE = "Closed Complete";
ChangeRequestStateHandlerNew.CANCELLED = "Cancelled"; // This is also not OOTB
Now in the initialize function:
ChangeRequestStateHandler.prototype = Object.extendsObject(ChangeRequestStateHandlerSNC, {
initialize: function(changeRequestGr) {
ChangeRequestStateHandlerSNC.prototype.initialize.call(this, changeRequestGr);
this.STATE_NAMES["1"] = ChangeRequestStateHandlerNew.DRAFT;
this.STATE_NAMES["9"] = ChangeRequestStateHandlerNew.REVIEW;
this.STATE_NAMES["10"] = ChangeRequestStateHandlerNew.APPROVAL;
this.STATE_NAMES["2"] = ChangeRequestStateHandlerNew.WORK_IN_PROGRESS;
this.STATE_NAMES["3"] = ChangeRequestStateHandlerNew.CLOSED_COMPLETE;
this.STATE_NAMES["13"] = ChangeRequestStateHandlerNew.CANCELLED;
},
type: "ChangeRequestStateHandler"
});
Please tell me now what I have to do.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2017 11:09 PM
Hi Saptashwa,
I can see that you are not using the OOB 'ChangeRequestStateHandlerSNC'. Well in this case, please create/modify the new one properly. Also make sure wherever this Script include gets called (for example, UI Action), you will end up modifying each and everything.
Once you are done with modifying 'ChangeRequestStateHandler', please modify the OOB Script includes for corresponding types.
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-09-2017 11:32 PM
Actually I saw that there is a business Rule "State Model- Can Move? " Here
From here the Script include is called.
Now when I am modifying the "ChangeRequestStateModel_emergency" script include as per my states. It is not working.
Because as you suggested to define:
var ChangeRequestStateModel_emergency = Class.create();
ChangeRequestStateModel_emergency.prototype = Object.extendsObject(ChangeRequestStateModelSNC_emergency, {
Draft: {
nextState: [ "Review" ],
Review: {
moving: function() {
return this.toReviewCust_moving();
},
canMove: function() {
return this.toReviewCust_canMove();
}
},
},
toReviewCust_moving : function() {
return true;
},
toReviewCust_canMove: function() {
return true;
},
type: "ChangeRequestStateModel_emergency"
});
Just created for two states for now. But not working still. Actually "toReviewCust_moving" is not getting called. I have put a info message and it is not showing.