- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2024 04:58 AM
On a table, there are 15 VIEWS created. I need to seach for a field say 'ABC'.
How to know in which of the 15 views this field 'ABC' is avaialble.
I checked form views, sections, elements etc etc.. but couldnt find a way 😞
Appreciate if you can help 🙂
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2024 05:21 AM
This may get you started, but please, check all the variables.
var viewGR = new GlideRecord('sys_ui_view');
viewGR.addQuery('name', 'my_table');
viewGR.query();
while (viewGR.next()) {
var sectionGR = new GlideRecord('sys_ui_section');
sectionGR.addQuery('view', viewGR.sys_id);
sectionGR.query();
while (sectionGR.next()) {
var elementGR = new GlideRecord('sys_ui_element');
elementGR.addQuery('section', sectionGR.sys_id);
elementGR.addQuery('element', 'my_field');
elementGR.query();
if (elementGR.next()) {
gs.print('View "' + viewGR.getValue('name') + '" contains "my_field".');
}
}
}
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2024 05:09 AM
Hi @Suggy
I think OOTB , there is no option to get that.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2024 05:21 AM
This may get you started, but please, check all the variables.
var viewGR = new GlideRecord('sys_ui_view');
viewGR.addQuery('name', 'my_table');
viewGR.query();
while (viewGR.next()) {
var sectionGR = new GlideRecord('sys_ui_section');
sectionGR.addQuery('view', viewGR.sys_id);
sectionGR.query();
while (sectionGR.next()) {
var elementGR = new GlideRecord('sys_ui_element');
elementGR.addQuery('section', sectionGR.sys_id);
elementGR.addQuery('element', 'my_field');
elementGR.query();
if (elementGR.next()) {
gs.print('View "' + viewGR.getValue('name') + '" contains "my_field".');
}
}
}
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2024 05:20 AM
So there is no easy way? One should use a script for that 😞
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2024 06:06 AM
Hi @Suggy ,
If u are not comfortable with the script then u can better check each view manually by opening from the record or u can open form designer n from there u can change views of the form n check manually.
Thanks,
Danish
