How to get the sys_id for sysapproval_approver table from a particular change request from REST API

Anshuman7
Tera Contributor

Hi I want to get the sys_id for sysapproval_approver table to approve / reject a change . In order to do that can I get the sys_id from the change request using REST API . I only have the change request number , by using that I need to get the all sys_id (approval) for that change 

6 REPLIES 6

viacheslavs
Giga Contributor

It looks good.

the output of API "api/now/table/sysapproval_approver?sysparm_query=sysapproval=" returns the document id like below:

<document_id>
<link>https://.service-now.com/api/now/table/change_request/625cfc718708___5fb10273cbb35ca</link>
<value>625cfc718708___5fb10273cbb35ca</value>
</document_id>
<sys_id>07710a061b___5628ce54bcbc5</sys_id>
<sys_updated_by>VIACHESLAV.@.COM</sys_updated_by>
<register_account/>
<sys_created_on>2025-03-04 11:23:34</sys_created_on>
<iteration>1</iteration>
<state>requested</state>
<approval_source/>
<sys_created_by>VIACHESLAV.@.COM</sys_created_by>

Question: can the sys_id parameter be used to approve the change by using the service account? For instance, the patch request:

https://.service-now.com/api/now/table/sysapproval_approver/07710a061b___5628ce54bcbc5
{
    "state": "approved"
}
In my case the backend returns 200, but the state has not been changed:
      "state": "requested"

Could you please clarify if there is a chance to use the service account to approve the change request in respect of application user?

BR, Slava



If I'm reading the out-of-box ACL on the state field for an approval record the account trying to change the state has to either be the approver (or delegate) or have the "approval_admin" role.

ChrisBurks_0-1741096784753.png

Note: The instance depicted in the screenshot has also installed plugins that use the snc_internal/snc_external roles. So if your instance has them too then the service account must also have that and any other configurations to security your instance has set up.