g_form.setDisplay() not working when replacing g_form.setVisible()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
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
yesterday
@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
yesterday
I'm applying this for form in native view
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
what type of form is this? native or portal?
screenshots please
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
native view
