How to fetch a record with all fields from query object at a time while retrieving the data from GlideRecord?

Community Alums
Not applicable

Hi All,

i want to get   the record with all the fields from query object.

for example i have a table with   these 3 fileds

cmp_name,

address,

partner

without mentioning filed names i want to get record .

Thank you

1 ACCEPTED SOLUTION

Hi Rajendra,



Here's a blog post that describes how to do what you're looking for.



Community Code Snippets - GlideRecord to Object Array Conversion


View solution in original post

3 REPLIES 3

Brad Tilton
ServiceNow Employee
ServiceNow Employee

Could you describe a little more about what you're looking to do? You should be able to query records and retrieve their values through GlideRecord.



ServiceNow Developers


Community Alums
Not applicable

Thanks Brad for your quick response.


my query like this.


var gr = new GlideRecord('table_name');


gr.query();


while(gr.next()){


var name = gr.name;


var addr = gr.addr;


}



in above query we are mentioning each field name, without mentioning fields   i need whole record as below


{name:"sssss",addr:"addr-1"}



thanks


Hi Rajendra,



Here's a blog post that describes how to do what you're looking for.



Community Code Snippets - GlideRecord to Object Array Conversion