Hide empty fields on a form

gustavo1
Kilo Contributor

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.

7 REPLIES 7

Aaron40
Kilo Guru

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 Stanger
Giga Sage

http://www.servicenowguru.com/scripting/business-rules-scripting/hide-empty-variables-standard-form/


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?