- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2016 01:52 PM
I have configured mandatory fields for our Change form through UI Policy. I now need to configure a UI Action to cancel the change. Upon choosing this Cancel menu option, we are currently prompted regarding the mandatory field requirements. How can I disable the mandatory fields through this UI Action. Below is my feeble attempt which is currently not working (I only added one field for testing):
function cancel (){
if(g.form.getValue('short_description')=="")
g_form.setMandatory('short_description, false');
}
//Canceled state
var recordState = current.state.getDisplayValue();
current.state = 4;
// update all the waiting approval to not longer required
var gr = new GlideRecord('sysapproval_approver');
gr.addQuery('sysapproval', current.sys_id);
gr.query();
if(gr.next()){
do {
if(gr.state == 'requested') {
gr.state = 'Canceled';
gr.comments = 'The change has been canceled. Your approval is no longer required.'
gr.update();
}
gs.eventQueue("change.approver.canceled", gr, gr.approver.getName(), gs.getUserName());
} while (gr.next())
}
current.approval = 'Canceled';
moveToCancel();
function moveToCancel(){
current.update();
action.setRedirectURL(current);
current.moveTo("Canceled")
}
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2016 02:03 PM
Hi Kari,
Create a UI action with the "action name" field set to sysverb_cancel.
It will then ignore the mandatory fields and do what you need.
For what it's worth, place this in the form context menu so people don't accidentally click it instead of Update or some other button.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2016 01:59 PM
Hi Kari,
Re: How to disable all the mandatory fields using single function/command. post might be helpful.
Thanks
Sheeba Srinivasan

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2016 02:03 PM
Hi Kari,
Create a UI action with the "action name" field set to sysverb_cancel.
It will then ignore the mandatory fields and do what you need.
For what it's worth, place this in the form context menu so people don't accidentally click it instead of Update or some other button.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2016 02:10 PM
Thank you! This worked perfectly and yes, it is just in the context menu.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2021 06:42 AM
Hi Chuck,
It's working fine on Native view. but not working in Portal.
Is there any alternate way to achieve this.
Thanks,
Vivek