- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-01-2016 11:51 PM
As an OOB configuration, we have a UI action 'Cancel Change' that cancels a change request. This UI action will be visible to all the ITIL users.
I want to restrict the visibility conditions of this UI action such that it should be visible only
1. to requested by users
2. at states New(-5), Assess(-4), Authorize(-3) and Scheduled(-2).
I tried to update the condition but of no use.
gs.hasRole('itil') && (gs.getUserID() == requested_by) && ((current.state == -5) || (current.state == '-4') || (current.state == '-3') || (current.state == '-2')) && new ChangeRequestStateHandler(current).canMoveTo("canceled")
Kindly help.
Thanks in advance!!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2016 12:03 AM
Try below condition
gs.hasRole('itil') && (current.requested_by== gs.getUserID()) && ((current.state == '-5') || (current.state == '-4') || (current.state == '-3') || (current.state == '-2')) && new ChangeRequestStateHandler(current).canMoveTo("canceled")
Thanks,
Mihir
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2016 12:03 AM
Try below condition
gs.hasRole('itil') && (current.requested_by== gs.getUserID()) && ((current.state == '-5') || (current.state == '-4') || (current.state == '-3') || (current.state == '-2')) && new ChangeRequestStateHandler(current).canMoveTo("canceled")
Thanks,
Mihir
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2016 12:17 AM
Thanks Mihir, it worked.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-25-2020 01:37 AM
I need to display cancel change for requested by user in 3 states only and for change manager it should be displayed always. Please suggest
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2016 12:03 AM
Did you try:-
current.requested_by==gs.getUserID() ; instead of only requested_by..
Mark Correct if it solved your issue or hit Like and Helpful if you find my response worthy.
Thanks,
Deepa
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-14-2016 12:13 PM
I am updating the OOTB Cancel Change UI action to include mandatory check on 'reason' field & add comment into work_notes upon Canceling Change.
I am incorporating the on-click functionality.
Condition: gs.hasRole('itil') && new ChangeRequestStateHandler(current).canMoveTo("canceled")
// Client-side 'onclick' function
function cancelchange(){
if(g_form.getValue('reason') == ''){
//Remove any existing field message, set Reason mandatory, and show a new field message
try {g_form.hideFieldMsg('reason');} catch(e) {}
g_form.setMandatory('reason', true);
g_form.showFieldMsg('reason','Reason is mandatory when canceling a Change Request','error');
return false; //Abort submission
}
else {
//Call the UI Action and skip the 'onclick' function
gsftSubmit(null, g_form.getFormElement(), 'cancel_change'); //MUST call the 'Action name' set in this UI Action
}
}
if(typeof window == 'undefined') {
moveToCancel();
}
function moveToCancel(){
action.setRedirectURL(current);
if (new ChangeRequestStateHandler(current).moveTo("canceled")) {
current.update();
}
}
I left the OOTB moveToCancel unchanged, but it appears that it does not work in conjunction with on-click functionality. I'm guessing it's trying to execute the moveToCancel on Server Side. I need all the funcitonality of the ChangeRequestStateHandler(current).moveTo("canceled") which will cancel current workflows & update open Approval records to no long required. Can you pls assist with workaround ?