Logic App: Read Service Now
Description:
So while working with Service Now developers to move to an Event Based setup, I wrote a Logic App in the interim that scans Service Now for new requests every minute and calls an Azure Automation job if a new record was created. Here are the steps:
To Resolve:
-
Trigger => Recurrence set to
1 week
, thenM-F
every minute between8am and 5pm
- HTTP Action:
- Method: GET
- URI: (You will need to tweak this in Postman but the idea is filter on the short description. Example
https://yourcompany.service-now.com/api/now/table/sc_request?sysparm_query=short_description%3DSomething&sysparm_limit=10&state=1
this will get ‘Something’ with a state of ‘New’ from the request table. - Headers: Authorization (your authorization method)
-
Store the
Body
of the response in a variable namedGet-SNResponse
. -
Initialize an integer variable with
0
-
Store the length of the first variable in another variable
length(variables('Get-SNResponse'))
- Add a condition that if length is greater than
13
, call an automation job. Or as I did, have it increment the first integer variable and then create another condition that says if that variable is greater than 0, create an automation job - same thing.
Comments