Windows PowerShell

TIP: Query servicenow Incident record using PowerShell and REST API

In order to query the servicenow incident records and to list out the required fields use the sysparm_fields column which helps in optimization. Now,  See the code, result and performance

All Fields

Here is the result! (8 seconds for one record)

Selected Fields!

It’s 6 seconds! Approximately we get 2 seconds per record. Good Sign! And see how it impacts if you select with pipe line for all fields.

Tip: Use the filter parameters as effective as possible.

3 thoughts on “TIP: Query servicenow Incident record using PowerShell and REST API

  1. Is there a way to do this without access to the API URL? My org is very restrictive yet I’d like to be able to manage my tickets through Powershell. They also use SSO

    1. The User needs no roles to make REST API calls. However, in order to create records it depends upon the ACL for that table. Connect with your tools admin and get Web Service Role access or it_admin role (I am not sure).

Leave a Reply

Your email address will not be published. Required fields are marked *