How to prevent submission of a catalog item when a Yes/No field is set to "No,

SomyaSwaroC
Tera Contributor
1 ACCEPTED SOLUTION

Voona Rohila
Mega Patron
Mega Patron

Hi @SomyaSwaroC 

Can you share the code you tried?

 

You have to write an OnSubmit client script and return 'false' if the value is 'No'

if(g_form.getValue('variable_name') == 'No' )  //replace variablename
    return false;

Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP

View solution in original post

3 REPLIES 3

Sumanth16
Kilo Patron

Hi @SomyaSwaroC ,

 

 add an alert at the beginning to answer the question of what value is detected:

function onSubmit() {
    var atgm = g_form.getValue('atgm_user');//replace with your variable name
    alert(atgm);
    if (atgm == 'false') {
        alert(getMessage('You have to be an ATGM user in order to use PDMLink with CREO. You cannot submit this request if you are not an ATGM user.'));
        return false;
    }
}

 

If you find it helpful, please mark my answer as correct so that it can useful to others.

 

Thanks & Regards,
Sumanth Meda

still it is not preventing the catalog item request submission.

 

Voona Rohila
Mega Patron
Mega Patron

Hi @SomyaSwaroC 

Can you share the code you tried?

 

You have to write an OnSubmit client script and return 'false' if the value is 'No'

if(g_form.getValue('variable_name') == 'No' )  //replace variablename
    return false;

Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP