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 apply flash for mandatory fields?

bharu
Kilo Expert

Hi,

function onSubmit() {  

  var fieldCheck = g_form.getValue('u_yes');  

  if (fieldCheck=='false') {  

          g_form.setMandatory('u_yes', true);

    alert('The top five fields in this form are mandatory');

    g_form.getControl('yes').focus();

          return false;  

  }  

}  

Iam getting an alert and field is also to madatory on running this code. But I want flash at the time when alert appears. "g_form.flash" is not working. Is there any alternate for this?

6 REPLIES 6

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Bhargava,



Please find the section 9.2 for more info on this.


GlideForm (g form) - ServiceNow Wiki


Same thing I applied. But no use. g_form.flash("abc.yes", "#FFFACD", 0); I have a label on top of check-box which i set to mandatory on submit. Same time i need flash. The above is code is not working. Even it is not working for any field.


bharu
Kilo Expert

In g_form.flash("tablename.field", "#FFACD",0), table name i have give is abc. Should that table contain field specified. My field here is checkbox.


Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Is table name abc or u_abc. I think this is a custom table and it should be u_abc.