Get all values (fields) from GlideRecord object

Michal Fish
Tera Contributor

Hello, 

I am just wondering, if it is possible to get all possible values / fields from record successfully get from GlideRecord query?

Or each field has to be addressed manually?

I was thinking about similar output like in Powershell with Select * .

Thank you!

1 ACCEPTED SOLUTION

Anil Lande
Kilo Patron

Hi,

You always get all field values from the GlideRecord query.

When you get value then you can read them like gr.column_name.

If you want to access all fields then you can script like this:

var incGr = new GlideRecord('incident');
incGr.get('d71da88ac0a801670061eabfe4b28f77'); // a sys_id of a incident
for (var key in incGr) {
			gs.info('Attribute Name : '+key +' Value : '+incGr[key]);
}

 

Thanks,
Anil Lande

View solution in original post

2 REPLIES 2

Anil Lande
Kilo Patron

Hi,

You always get all field values from the GlideRecord query.

When you get value then you can read them like gr.column_name.

If you want to access all fields then you can script like this:

var incGr = new GlideRecord('incident');
incGr.get('d71da88ac0a801670061eabfe4b28f77'); // a sys_id of a incident
for (var key in incGr) {
			gs.info('Attribute Name : '+key +' Value : '+incGr[key]);
}

 

Thanks,
Anil Lande

great, this is exactly , what I was looking for and this even did not come up to my mind 🙂

Thank you