If user don't select check box field then abort submit button in catalog item in servicenow

Sameeksha M
Tera Contributor

If user don't select check box field then abort submit button with error message in catalog item in servicenow.

 

User should choose at least any one of these choices, if user do not select any of these checkbox then user should not able to submit request and error message should pop up.

SameekshaM_0-1675940946606.png

Please help me with this query.

Thanks in advance!

9 REPLIES 9

Community Alums
Not applicable

Are your selecting 'Selection Required' in both the checkboxes.

Only select the first checkbox.

Community Alums
Not applicable

Try using below UI Policy

 

AnandMahajan_0-1676985413723.png

 

 

Community Alums
Not applicable

Hi @Sameeksha M ,

Use this Catalog client script(onSubmit) model.

function onSubmit() {

    var c1 = g_form.getBooleanValue('check1'); //enter your field name of checkbox.
    var c2 = g_form.getBooleanValue('check2');

    if (c1 == false && c2 == false) { //if both the checkboxes are unselected
        g_form.addErrorMessage("Kindly select atleast one check box");
        return false; //simply use this line if you want to abort submit action.
    }
}

 

 

errormsg.png

If this solves your problem, please mark this as correct.

Khasim Pathan.

jcmings
Mega Sage

Business rule on before insert that aborts and flashes an error message if no checkboxes are selected? Or an onSubmit client script that checks and aborts submit?