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.

Show field message function in Service Portal

Nowlearner
Kilo Guru

I am using g_form.showFieldMsg option in client script to display a message below the field when the country field is selected as USA. It is working fine when i click try it at the item level but not in the Service Portal.  

Do we have to write any special line of code specific to work on the Service Portal?

1 ACCEPTED SOLUTION

This may also work:

g_form.showFieldMsg('display_name', 'USA timezone is different','info',true);

View solution in original post

9 REPLIES 9

What happens if you change the below:

g_form.showFieldMsg('display_name', 'USA timezone is different');

to 

alert('USA timezone is different');

?

This may also work:

g_form.showFieldMsg('display_name', 'USA timezone is different','info',true);

Wooaaah!!!!! It worked, thanks alot 🙂

Hi ndt13, 

I have a field called Option(multiple choice) and I have 3 choices under this.(A , B , C)

I wanna show a field msg under Option when A is selected.

I tried this but isn't working.

Can you please help me here.

function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
g_form.getValue('options', 'New Hire');
g_form.showFieldMsg('Option' ,'If New Hire, state that accessories are included (Two Monitors, Docking Station, Monitor Cables, Keyboard and Mouse)', 'info'), true;

//Type appropriate comment here, and begin script below

}

 

find_real_file.png

Inactive_Us2276
Kilo Contributor

Hi Nikitha.

Do not forget that you have to clean after the message. with this code.

 g_form.hideFieldMsg('display_name');

 

regards

 

Richard.