Mandatory Field not Mandatory!

Cirrus
Kilo Sage

All,

This should be easy, shouldn't it? Using UI Policies, when a call comes into ServiceDesk, they can select a call type. For one particular call type (X), they then select a sub-type which is a mandatory selection. If that sub-type selection is 'Y' then a new true/false field called Terms and Conditions (u_tc) will appear. We want u_tc field to be mandatory also, but when I create a new policy which is applied when Type = X and Sub-Type = Y, with the UI action set as u_tc mandatory = true, visible = true, the user can still complete the ticket without checking u_tc. 

I have even tried an On Load client script (removing the mandatory = true portion above so that the field still appears):

function onLoad() {
//Type appropriate comment here, and begin script below
if(g_form.getValue('y') == value)
g_form.setMandatory('u_tc', true);
}

What am I doing wrong here?

1 ACCEPTED SOLUTION

You can't make True/False field mandatory using UI policy

You have to either write an onSubmit client script or change to field choice type with Yes/No values

Below links might be helpful

https://community.servicenow.com/community?id=community_question&sys_id=0fbec761dbdcdbc01dcaf3231f961950

https://community.servicenow.com/community?id=community_question&sys_id=1e83ce61dbe85bc00e3dfb651f9619d9

View solution in original post

8 REPLIES 8

sachin_namjoshi
Kilo Patron
Kilo Patron

You don't need to write client script for this requirement since you can achieve this using UI policy.

Please check if there are any conflicting UI policies for your form which is causing this issue.

 

Regards,

Sachin

Community Alums
Not applicable
if(g_form.getValue('u_subtype') == value) In the getValue use the field name

Cirrus
Kilo Sage

Thanks both. Sachin, as far as I can see there are no conflicts. Type X (top level) is set mandatory in the dictionary entry. The sub level choices are set mandatory via the UI actions, and each sub type is unique to the level above, so there should be no conflicts. The only thing I was thinking is does it not like it because its a True/False field? I noticed on the dictionary view of this field that it doesnt have a mandatory checkbox.

Hardit, sorry, my typo in anonomizing the data. I had used the correct field name

ggg
Giga Guru

you will  have 2 ui policies: 1) type is x 2) subtype is yes

1) when type is x

    subtype is visible and mandatory

2) when subtype is yes

   tandc is visible and mandatory