g_form.setDisplay() not working when replacing g_form.setVisible()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2026 12:16 AM
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2026 06:15 AM
@armanoj,
Check if table and field scope matches the client script scope.
https://www.servicenow.com/community/developer-blog/scoped-applications-and-client-scripts-a-primer/...
This article might explain the issue, check out setDisplay part.
Please Accept this response as Solution if it assisted you with your question & Mark this response as Helpful.
Kind Regards,
Ehab Pilloor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2026 02:15 AM
I'm applying this for form in native view
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2026 03:15 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2026 03:37 AM
native view