How to add field message to selectbox

Appu
Tera Guru

Hi All,

i am creating a catalog item in that I have a select box as Impact with choices as Level 1, Level 2, and Level 3

if level 1 is selected i need a text to be displayed similarly for level 2 and level 3 but the texts are different.

how do I do that? kindly help me

1 ACCEPTED SOLUTION

Hi,

you should be using the variable name which is impact and values as L-1 etc

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading) {
        return;
    }
    
g_form.hideFieldMsg('impact');

if(newValue == 'L-1'){
g_form.showFieldMsg('impact', 'TESTING Message 1' ,'error', true);

if(newValue == 'L-2'){
g_form.showFieldMsg('impact','TESTING Message 2','error', true);
}

if(newValue == 'L-3'){
g_form.showFieldMsg('impact','TESTING Message 3','error', true);
}

}

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

8 REPLIES 8

find_real_file.png

 

This is my catalog client script but didn't get the result

find_real_file.png

This is the variable

Hi,

you should be using the variable name which is impact and values as L-1 etc

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading) {
        return;
    }
    
g_form.hideFieldMsg('impact');

if(newValue == 'L-1'){
g_form.showFieldMsg('impact', 'TESTING Message 1' ,'error', true);

if(newValue == 'L-2'){
g_form.showFieldMsg('impact','TESTING Message 2','error', true);
}

if(newValue == 'L-3'){
g_form.showFieldMsg('impact','TESTING Message 3','error', true);
}

}

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Thankyou its Working

You are welcome.

Please mark appropriate response as helpful.

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader