Make comments mandatory on click of a ui action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2014 06:15 AM
Good Afternoon everyone,
I currently have an issue where I need to make the comments field on the sys_approval table mandatory when a user is rejecting a change. This would work by the user clicking on the reject ui action and then it would not let them reject the change until a comment has been put into the comments field. Has anybody done this before?
Thanks,
Luke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2014 06:19 AM
Hi Luke,
Yes, you can do this by setting a Flag field on the Approval Form. The Flag field can be a True/False field.
Keep this field on the Approval form and Hide it unconditionally with a UI Policy.
Now, in your 'reject' UI Action, just add this line: current.u_flag ='true';
Now write another UI Policy, so that when the Flag is set to True, the Comments field turns Mandatory.
Thanks,
Subhajit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2020 09:16 AM
Thank you! This worked perfectly for me!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2014 06:22 AM
You can try an onsubmit client script like this:-
function onSubmit() {
var action = g_form.getActionName();
if(action=='reject'){
g_form.setMandatory("comments",true);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2014 06:32 AM
I would incorporate the reject button into this:
http://www.servicenowguru.com/system-ui/glidedialogwindow-quickforms/
I think it is a better user experience, and can be used in the list view, as well.