- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2021 08:03 AM
Hi ,
I need to retrieve specific column from table instead of whole row from Gliderecord . Have noticed it can be achievable through "sysparm_fields" in table API . How can I do in Gliderecord . Please help.
Regards
Sagaya
Solved! Go to Solution.
- Labels:
-
Integrations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2021 08:38 AM
Hi,
specify your fields separated by comma
sysparm_field = number,short_description,caller_id.name
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2021 08:11 AM
Hi Sagaya
You can limit your query to specific fields in a server-side Glide query by using GlideAggregate instead of GlideRecord to query the table.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2021 08:45 AM
Hi Sukrit,
Thank you for the details .GlideAggregate is use for count /min/max operations . I need to retrieve specific columns of the record like sysparm_fields.
sysparm_fields Sample : sysparm_fields=dname%2Cu_aname%2Coccurdate_time%2C%2Ccleareddate_time
The above sysparm_fields will retrieve only 4 column [dname ,aname, occurdate_time and cleareddate_time] instead of all column. GlideRecord will pull all column of the specific record .
Sagaya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2021 08:59 AM
Try using groupBy
var ga = new GlideAggregate('sys_user');
ga.groupBy('user_name');
ga.groupBy('sys_id'); // This makes sure we get all records, even if there are duplicates
ga.query();
while (ga.next()) {
// Do what you need to with the user_name field
}
This would return 'user_name' and 'sys_id' fields.
Add another groupBy() for each field you need included in the results.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2021 08:38 AM
Hi,
specify your fields separated by comma
sysparm_field = number,short_description,caller_id.name
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader