How to get all fields which are available on form only.

Peter Wood
Kilo Guru

Hi All,

I am working on Application table(cmdb_ci_appl) how do I get only fields which are on form not all class fields.

Thanks.

1 ACCEPTED SOLUTION

Dhananjay Pawar
Kilo Sage

Hi,

Check this, It may help you.

function onLoad() {
var arr = [];
for (var x = 0; x < g_form.elements.length; x++) {
arr.push(g_form.elements[x].fieldName);
}
alert("array value = " + arr);
}

 

Thanks,

Dhananjay.

View solution in original post

11 REPLIES 11

Pranav Bhagat
Kilo Sage

Are you trying to do it using scripts ? 

 

If yes this script can help you

 

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) {}
}

 

FYI:This script uses DOM Manipulation which is not a best practice and also to run this script you have disable to isolated script setting on the client script page. 

is there any OOB way available?

I don' think there is any OOTB way.

Hi,

I tried same, but nothing I am getting.

Do I need to change anything?

Thanks.