Make label for checkboxes mandatory

Sherice1
Tera Contributor

Hello All,

I am trying to make label for check boxes mandatory. I have checked the mandatory check box for that field but it is not working on itil view but working on portal view. So I wrote a UI policy even it is working on Portal but not on ITIL view and so I wrote Client script even its the same. Does anyone know what might be the issue that stopping them triggering on ITIL view.

 

Portal view -- find_real_file.png

 

Itil view -- find_real_file.png

 

Regards,

Chipsy.

1 ACCEPTED SOLUTION

Allen Andreas
Administrator
Administrator

Hi,

To make a label mandatory above checkboxes you need to first add the label, choose no other setting.

Then add your checkboxes with an order to where they'd appear next to each other right under the label variable.

In the first checkbox that appears after label, check the "selection required" / "mandatory" box in the top-right corner of the variable settings.

Then....on your form, it will look like this:

find_real_file.png

then select one:

find_real_file.png

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

View solution in original post

11 REPLIES 11

Hello Allen

 

You answer worked like a magic. But I want to know how come it is triggering in that way but not with scripts. Can you please explain.

Hi,

Unfortunately, without seeing your scripts and settings and such, I can't speak for that. My method uses no client script or UI policy. If you can share what you have specifically set and the associated script, we can take a peek.


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Oh boy, thank you Allen.

Wish I had seen this post sooner than all the other so called 'solutions'. Could ve saved me 2 hours..

Hi Allen,

 

Would we be able to accomplish this if we used Macro with Label field?

Thanks

Hi,

Yeah, this one is a tricky one.

So out of box there is no mandatory setting for macro with label field type variables. When you select this type of variable the mandatory checkbox that is normally seen on the variable settings page, disappears. If you override it and bring it back, and check the box, the asterisk, I believe will show, but it will not enforce that mandatory nature on submit.

If you try to use a UI Policy to make it mandatory, that macro with label field isn't even a valid selection.

If you try to use a client script to g_form.setMandatory on that variable, that too...doesn't work.

The only option left is to check that that field has a selection/value on submit via client script. Use this thread for working script as an example: https://community.servicenow.com/community?id=community_question&sys_id=32e1cba9db98dbc01dcaf3231f96...

Please mark reply as Helpful, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!