Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

g_form.setDisplay() not working when replacing g_form.setVisible()

armanoj
Mega Sage

 

Hi Community,

I am trying to replace g_form.setVisible() with g_form.setDisplay() in a Client Script.

The existing code using setVisible() works as expected:

g_form.setVisible('field_name', false);

However, when I replace it with:

g_form.setDisplay('field_name', false);

the field is still visible on the form.

I have verified that I am using the correct syntax and the correct field name. The Client Script is executing, and setVisible() works correctly for the same field, but setDisplay() does not seem to have any effect.

Has anyone experienced this behavior?

13 REPLIES 13

I'm trying this in native view and those fields are not mandatory.

 

@armanoj,

 

Can you share screenshot of the script you have written?

 

Regards,

Ehab Pilloor

@armanoj 

is this happening with another field as well or only this field?

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

i tried with other fields also but not updating for setDisplay()