Server script to check the value of all fields in a form section
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2017 09:26 PM
Hi all,
Is there a way we can glide through all the fields under a form section using form section name ??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2017 09:34 PM
Hi Padmini,
I don't think this is possible unless you know which fields are present in the individual section and you need to check every field.
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2017 09:52 PM
Hi Padmini,
You can query the sys_ui_element table with the sys_ui_section field and get the list of fields present in that particular section.
A sample script I created is as below.
var gr = new GlideRecord('sys_ui_element');
gr.addQuery('sys_ui_section.name','incident');
gr.addQuery('sys_ui_section.caption','Related Records');
gr.query();
while(gr.next())
{
gs.print(gr.element);
}