- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2023 10:38 PM
Hi Everyone.
Anyone can help me to get only name of field under form tab in client side script.
For example resolution information tab , I need the name of column only under resolution information tab on load of form to make the filed non mandatory to achieve similar use case.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2023 11:58 PM
Hi @ramancoder ,
The fields in a section are stored in the Section Elements [sys_ui_element] table.
Section: Resolution Information (Default View)
URL: https://<instance_name>/sys_ui_element_list.do?sysparm_query=sys_ui_section%3D992099dd0a0006413c77c9...
Just query to that table and you can have all the fields name under a specific section.
1. Define a function in an AJAX Script Include.
Sample below.
getResolutionFields: function() {
var sectionID = gs.getProperty('cl.incident.section.resolution_information'); //992099dd0a0006413c77c9a4b7d410c0
var arrElement = [];
var grElement = new GlideRecord('sys_ui_element');
grElement.addQuery('sys_ui_section', sectionID);
grElement.addNullQuery('type');
grElement.query();
while (grElement.next()) {
arrElement.push(grElement.getValue('element'));
}
return arrElement.join(',');
},
2. Call the function in the Client Script and you will have all the fields in response.
Let me know if it works for you.
Cheers,
Tai Vu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2023 11:58 PM
Hi @ramancoder ,
The fields in a section are stored in the Section Elements [sys_ui_element] table.
Section: Resolution Information (Default View)
URL: https://<instance_name>/sys_ui_element_list.do?sysparm_query=sys_ui_section%3D992099dd0a0006413c77c9...
Just query to that table and you can have all the fields name under a specific section.
1. Define a function in an AJAX Script Include.
Sample below.
getResolutionFields: function() {
var sectionID = gs.getProperty('cl.incident.section.resolution_information'); //992099dd0a0006413c77c9a4b7d410c0
var arrElement = [];
var grElement = new GlideRecord('sys_ui_element');
grElement.addQuery('sys_ui_section', sectionID);
grElement.addNullQuery('type');
grElement.query();
while (grElement.next()) {
arrElement.push(grElement.getValue('element'));
}
return arrElement.join(',');
},
2. Call the function in the Client Script and you will have all the fields in response.
Let me know if it works for you.
Cheers,
Tai Vu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2023 04:50 AM
Thank you. It is Working.