How to make Group By cases in table API

lucky6
Tera Contributor

Hi Everyone,

How can we make group by cases in table API.

10 REPLIES 10

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Lucky,

It would be something like this

api/now/table/sn_customerservice_case?sysparm_query=GROUPBYcontact&sysparm_fields=number,contact

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Thanks for the response but it is not working..

Hi,

please share your screenshots

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi,

if that doesn't work you can use GlideAggregate API

Example below

Endpoint: https://instanceName.service-now.com/api/now/stats/incident?sysparm_query=active%3Dtrue%5Eassigned_to%3D6816f79cc0a8016401c5a33be04be441&sysparm_count=true&sysparm_group_by=assigned_to

Output from APi:

find_real_file.png

Output from instance:

find_real_file.png

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader