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.

The Message in showFieldMsg is disappearing immediately

uma17
Tera Guru
Hi All,
 
In the below code the message in showFieldMsg is disappearing immediately after appearing. If  we remove the g_form.clearValue() the message stays but the invalid value does not get cleared,
 
if (X > Y) {
        g_form.clearValue('abc'); 
        g_form.showFieldMsg('xyz', 'AAAAAAAAAAAAAAAA, 'error');
        return;
    }
 
Any idea why ?
 
Thanks,
Uma
15 REPLIES 15

Anurag Tripathi
Mega Patron
Mega Patron

Why do you have  return; there?

Can you remove that and try again?

Also there is a ' missing in your script, use the below

 g_form.showFieldMsg('xyz', 'AAAAAAAAAAAAAAAA', 'error');

 

-Anurag

Hi Anurag,

 

If  I remove the return line the message is not displaying,

 

Thanks,

Uma

Did you change the script to

 g_form.showFieldMsg('xyz', 'AAAAAAAAAAAAAAAA', 'error');

-Anurag

Yes, It was a typo mistake when I was posting the question, it is in the correct syntax