Close Code and Close notes mandatory for Change Request in 'Canceled' state
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-27-2016 03:56 AM
As 'Cancel Change' is a UI Actions and it is not Client so we cannot use g_form.setMandatory function in UI Action. I tried to do it using Script include with 'Client Callable' but still I guess I can't use Glide Form functions in Script Include. I Tried with UI Policies also but not working. Can anyone suggest me solution for this??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-27-2016 04:00 AM
you will need to update the Cancel Change UI Action to run in the client first, here is one I use for ensuring work_notes are entered when cancelling, you can change this to display close code and notes and make them mandatory:
Client: True
onClick: cancelChange()
function cancelChange(){
var wn = g_form.getValue('work_notes');
if (wn == ''){
g_tabs2Sections.setActive(3);
g_form.flash('work_notes','red',1);
g_form.clearMessages('work_notes');
g_form.showFieldMsg('work_notes','Work Notes are Mandatory when Cancelling a Change','error');
g_form.setMandatory('work_notes', true);
return false;
}
gsftSubmit(null, g_form.getFormElement(), 'cancel_change'); //MUST call the 'Action name' set in this UI Action
}
//Ensure call to server-side function with no browser errors
if (typeof window == 'undefined')
moveToCancel();
function moveToCancel(){
action.setRedirectURL(current);
if (new ChangeRequestStateHandler(current).moveTo("canceled"))
current.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-27-2016 04:35 AM
Hi,
I tried it but when I try to open any change request, It is going back to list after loading the form page. I guess i we make the UI policy to run in Client side, We cannot use 'current' keyword as it is used in server side only.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-27-2016 05:52 AM
Hi,
Thank you. Its working now. I made mistake in placing Close bracket earlier.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-04-2016 06:12 AM
Anubhav,
I am having the same issue that you addressed above. I modified the script above to make this functional for Closed Notes and Close Code to be mandatory upon cancelling the change request. This works great. However, once I complete the fields and then select cancel again, it brings me back to the list view of All the change requests and the one I canceled in particular does not go into a Canceled stated. Any Ideas? Here's the code I'm using: