- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-10-2015 03:19 AM
Can nayone help me with this please ?
I need a Yes/No checkbox on incident/task form with name as Advisers Consulted and i want it to be mandatory.
Mechanism behind this is that the person who is working on the incident if he/she is taking help from advisers then they should check the checkbox.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-10-2015 03:53 AM
Hi Shikha,
When you say make the check box mandatory, what option does the user have but to check it. when unchecked it by default indicates 'no'. Its as good as forcing the user to check it.
So instead of a check box you might consider a drop down with yes/no values and default to none. now when you make in mandatory the user will have the choice to select yes or no in that field.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-10-2015 03:26 AM
Hi Shikha,
Create a new field of type 'Choice' and add the choices.You can use the OOB mandatory attribute.
Creating New Fields - ServiceNow Wiki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-10-2015 03:53 AM
Hi Shikha,
When you say make the check box mandatory, what option does the user have but to check it. when unchecked it by default indicates 'no'. Its as good as forcing the user to check it.
So instead of a check box you might consider a drop down with yes/no values and default to none. now when you make in mandatory the user will have the choice to select yes or no in that field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-10-2015 06:13 AM
Hi Anurag & Kirti,
I have applied a checkbox on my incident form and them i was having a client script of making close_notes & close_code when incident state changes to resolve as follows :
function onSubmit() {
var action = g_form.getActionName();
if (action != 'close_incident' && action != 'resolve_incident')
return;
// Close notes and Close code must be on the form
if (!g_form.getControl('close_notes') || !g_form.getControl('close_code'))
return;
var state = '6';
if (action == 'close_incident')
state = '7';
g_form.setValue('incident_state', state);
g_form.setValue('state', state);
g_form.setDisplay('close_notes', true);
g_form.setMandatory('close_notes', true);
g_form.setDisplay('close_code', true);
g_form.setMandatory('close_code', true);
if (g_form.getValue('close_notes') == '' || g_form.getValue('close_code') == '')
return false;
g_form.setDisplay('u_boolean_1', true);//advisor consulted checkbox
g_form.setMandatory('u_boolean_1', true);//advisor consulted checkbox
}
after that there was a UI policy for the same as follows :
and somehow it is working.....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-10-2015 06:22 AM
You need to make this a Choice, not a Boolean. Boolean can only ever be Yes / No. So if you make it mandatory you're essentially saying "always make this yes". Choice on the other hand gives you the option of saying Yes/No/Undefined. You default to Undefined and force user to pick either yes or no.
For your future scripts its probably not a good idea to name a script variable the same as a field on the form either.