Get array field of glideRecord object
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2022 05:18 AM
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
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2022 06:39 AM
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.