List today’s resolved ServiceNow incidents
Within ServiceNow Tokyo it is possible to resolve incidents. In this article I will show you how to retrieve incidents which have been resolved today via a Power Automate flow.
This question from ganeshn07:
I am using ServiceNow Connector to get the tickets details. But I am having problem to get the resolved/closed tickets on a particular date or between date range. Kindly help me to write query on how to achieve this.
Power Users Community thread: Get resolved/closed tickets on a particular date from ServiceNow connector.
Filters and Queries
The Query field of this action requires ServiceNow specific syntax. This is where the ServiceNow documentation will be useful. My suggestion would be to have a look at the Operators available for filters and queries article.
In this scenario we are interested in the incidents which have been resolved today. The Resolved (resolved_at) field is a datetime type of field. We want to retrieve all incidents in a date range of for example:
2024-01-31 00:00:00 and 2024-01-31 23:59:00
We can use the between operator for this. You can use @ character to separate the two datetime values for your date range for a specific datetime field. The format would be like below:
For this sample I have used a ServiceNow Tokyo developer instance.
1. Add a Recurrence action.
a. Select an Interval, in this setup 1
b. Select the Frequency, in this setup Day
c. Select the Hours, in this setup 18
d. Select the Minutes, in this setup 00
2. Add a List Records action.
a. Select a Record Type, in this setup Incident
b. Select the Display System References, in this setup No
c. Select the Exclude Reference Links, in this setup Yes
d. Provide a value for Query, in this setup use the value from the code snippet below
3. Add a Select action.
a. Provide a value for From, in this case the result of the List Records action.
b. Provide key/value pairs in the Map field, in this setup I was only interested in the Short Description and the Number of each incident
That should be it for the setup. The test result should look like the below. You could for example use the outputs of your Select in a HTML table and sent that as an email.