Hide empty fields on a form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-09-2013 11:00 AM
Hi all,
I'm trying to do something that I don't know if possible, here is what I was requested:
We have a table with a lot of fields and those fields will be populated through a Record Producer, the table will have as well table list and a form, in the form I need to show only the populated fields, those ones that are empty should be hidden.
We will never know what fields will be empty so I was wondering if possible, if so how can I get it?
Thanks in advance for the advices.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-09-2013 01:49 PM
Below is a generic loop-over-all variables on the catalog form. This combined with the logic posted earlier should get you the functionality you need without having to manually type 90+ conditions.
function onLoad() {
try {
var getFields = document.getElementById('variable_map').getElementsByTagName('item');
for(var i = 0; i < getFields.length; i++)
{
var field= getFields<i>;
g_form.setDisplay('variables.' + field.getAttribute('qname').toString(), false);
}
} catch(err) {}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-10-2013 05:41 AM
http://www.servicenowguru.com/scripting/business-rules-scripting/hide-empty-variables-standard-form/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-08-2019 10:58 PM
This is really old, and I'm not sure I'll get a response here, but I did exactly what is in the article but it doesn't work for me. I did it on the Task table (not sc_task, just task). The business rule first barks at me saying that I'm creating a global variable vars and need it to be "var vars". With or without that change, it still does not seem to hide any empty fields. Any clues?