Server script to check the value of all fields in a form section

pdom
Mega Expert

Hi all,

Is there a way we can glide through all the fields under a form section using form section name ??

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

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


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

Kannan Nadar
Tera Guru

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);


}