How to get the list of approvers and their email addresses using REST API
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-18-2017 03:27 PM
How to get the list of the approvers and their email addresses using REST API. I found this table sysapproval_approver but it's not clear to me how to get the approvers information for the specific list of tasks ?
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2017 12:59 PM
Hello Sergey,
Below is the GET method I've used to pull approver name and email address. Sample here
https://YOURINSTANCENAME.service-now.com/api/now/table/sysapproval_approver/220e5be447810200e90d87e8dee49087?sysparm_display_value=true&sysparm_fields=approver%2Capprover.email
220e5be447810200e90d87e8dee49087 is the sys_id of record
Output:
{
"result": {
"approver": {
"display_value": "Change Manager",
"link": "https://YOURINSTANCENAME.service-now.com/api/now/table/sys_user/f8588956937002002dcef157b67ffb98"
},
"approver.email": "change.manager@example.com"
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2017 06:01 PM
Great! Thank you so much, Pradeep!
I've figured out the way already but I was querying 4 different table to get all this date which is very slowish comparing to your one request.
Let me ask you how to query only users which have state = requested.
I was trying to add &sysparm_query=state=requested. However, it doesn't work
Thanks,
Sergey

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2017 06:20 PM
Thanks for the update. Use sysparm_query=state%3Drequested
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2017 11:34 AM
Awesome Pradeep, that works very good.
Could you please give me a hint on how that constructor works
sysparm_fields=approver%2Capprover.email ?
As I understand it takes fields approvers - go to that table - which is sys_user using user sys_id and grepping email from that table right ?
However, when I'm trying to get a user group I could do this adding approver.u_primary_group to the sysparm_fields request and it works
{
"approver.name": "Name",
"approver.email": "name@xx.yyy.zzz",
"approver.u_primary_group": {
"display_value": "Group name",
"link": "https://xxx.service-now.com/api/now/table/sys_user_group/a12062446dc402xxx006899316bd8b"
}
}
Is it possible to select just a "Group name" without link ?
approver.u_primary_group.display_value doesn't work