Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to get an info and alert message based on selection of option in select box variable

Asish1
Tera Contributor

Hi,

I have a select box with 2 options, we have to get an info and alert messages based on selection of the option in that variable

 

Thanks,

Asish

1 ACCEPTED SOLUTION

suvro
Mega Sage

Write a onCHange client script on that variable

 

if (newValue == "required choice value"){

g_form.addInfoMessage(" required message here");

alert("Required message");

}

// for other value if you need to display some other message

else {  

g_form.addInfoMessage(" other required message here");

alert("other Required message");

}

View solution in original post

3 REPLIES 3

suvro
Mega Sage

Write a onCHange client script on that variable

 

if (newValue == "required choice value"){

g_form.addInfoMessage(" required message here");

alert("Required message");

}

// for other value if you need to display some other message

else {  

g_form.addInfoMessage(" other required message here");

alert("other Required message");

}

Asish1
Tera Contributor

Its working @suvro Thanks 🙂

rubina khatun2
Tera Expert

Hi @Asish 

you can write the onChange() Client Script

---------------------------------------------------------------------

function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var emptype = g_form.getValue('SelceBox_variable');
if(emptype=='employee'){
alert('Message'+emptype);
}

else(emptype=='consultant'){
alert('Message'+emptype);
}

}

---------------------------------

please mark my comment  Helpful if it has solved your query.