Skip to content

Commit ecac3c3

Browse files
authored
Form field count (#1104)
* Create Form Field Count.js * Create readme.md
1 parent 8f53b8d commit ecac3c3

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
var count = 0;
2+
var maxFields = 30; //change to match your threshold/allowance
3+
var frmGr = new GlideRecord('sys_ui_form');
4+
frmGr.query();
5+
while (frmGr.next()){
6+
count = 0;
7+
var frmsecGr = new GlideRecord('sys_ui_form_section');
8+
frmsecGr.addQuery('sys_ui_form', frmGr.sys_id);
9+
frmsecGr.query();
10+
while (frmsecGr.next()){
11+
var secGr = new GlideRecord('sys_ui_section');
12+
secGr.addQuery('sys_id', frmsecGr.sys_ui_section);
13+
secGr.query();
14+
while (secGr.next()) {
15+
var eleGr = new GlideRecord('sys_ui_element');
16+
eleGr.addQuery('sys_ui_section', secGr.sys_id);
17+
eleGr.addNullQuery('type');
18+
eleGr.query();
19+
if (eleGr.next()) {
20+
count += eleGr.getRowCount();
21+
}
22+
}
23+
}
24+
if (count > maxFields) {
25+
gs.info('FORM FIELD SCRIPT: Fields on form ' + frmGr.name + ' = ' + count);
26+
}
27+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This background or fix script will list forms that have more than a certain number of fields (starting threshold is 30, but can be changed on line 2). It looks through all form sections, and excludes container starts and splits. Forms / sections with more than 30(?) fields will appear on the Health Scan / Impact report as a possible performance impact, causing the form to take a noticeable amount of time to load.

0 commit comments

Comments
 (0)