get column labels of fields in a table

xiaix
Tera Guru

Question: When I query a table (GlideRecord query) on the server side (via Script Include), how can I capture the Column Label of each field on the record?

If further information is needed, or if you would like to see my current script include, let me know.

1 ACCEPTED SOLUTION

Brad Tilton
ServiceNow Employee
ServiceNow Employee

Hi David,



Try gr[fieldName].getLabel()


View solution in original post

8 REPLIES 8

Brad Tilton
ServiceNow Employee
ServiceNow Employee

Hi David,



Try gr[fieldName].getLabel()


You, my friend, are Genius!


try this


I have used this on quite a few situations and there is a copy change record routine on here that covers this and how I used it



var gr = new GlideRecord('incident');


if(gr.get('number','INC0010001'))


{


recFields = gr.getFields();


for (i=0;i<recFields.size();i++)


{


var glideElement = recFields.get(i);


gs.log(glideElement.getName());


}


}


find_real_file.png