The CreatorCon Call for Content is officially open! Get started here.

Get array field of glideRecord object

sacha1
Tera Contributor

Hi, 

I was wondering if there was an optimised way of retrieving all field values of a queried glideRecord.

The naive way is iterating through each glideElement and push the field (sys_id for example) to an array. I feel like there should be an optimisation that doesn't require me to iterate with the next function.

 

Any input ?

Thanks in advance

10 REPLIES 10

GlideQuery seemed interesting but the toArray is limited to 100 results unfortunately. And i checked the body function, it just iterate through a stream object, so in the end it's the exact same performance as using a regular GlideRecord (a bit less even because i need to map the stream to extract the field i need) .

 

GlideQuery is very interesting nonetheless, thanks for that. I will be implementing it, feels way more readable than glideRecord.