cancel
Showing results for 
Search instead for 
Did you mean: 
Create Post
Level 12

Variable for ServiceNow Incident and Incident URL

I am currently using this custom SQL variable to grab the ServiceNow Incident Number and URL:

Incident Number: ${SQL:SELECT IncidentNumber FROM [dbo].[SNI_AlertIncidents] WHERE AlertObjectID = ${N=Alerting;M=AlertObjectID} ORDER BY IncidentNumber DESC}

URL: ${SQL:SELECT IncidentUrl FROM [dbo].[SNI_AlertIncidents] WHERE AlertObjectID = ${N=Alerting;M=AlertObjectID} ORDER BY IncidentNumber DESC}

The problem is, this only works sometimes. I believe there is some sort of delay in the ServiceNow integration so it can't grab the ticket number or url. Does anybody have a better solution for putting the ServiceNow Incident in URL in an alert?

0 Kudos
4 Replies

Maybe create an "escalation" that waits a minute or two before sending out the email.

@christopher.t.jones123 yeah that's what i ended up doing yesterday actually. it seems to be working so far...

0 Kudos

The ServiceNow integration "syncs" every 20 seconds. I'm not sure if it pulls out the ticket number immediately after sending the creation request but it should have it within 20 seconds when the next sync cycle occurs.

If you have your query trigger immediately when the alert triggers, the SolarWinds server typically won't have the incident number yet hence the blank fields.

Per @christopher.t.jones123, adding the escalation delay before sending the email should resolve it.

0 Kudos

i added the delay of one minute, but i was still having the issue, but i figured it out i think.

sometimes the query i run to grab the incident number returns two incident numbers, so i need to limit it to one like so:
${SQL:SELECT top 1 IncidentNumber FROM [dbo].[SNI_AlertIncidents] WHERE AlertObjectID = ${N=Alerting;M=AlertObjectID} ORDER BY IncidentNumber DESC}

 

i am going to implement this change tonight and see if it resolves the issue. i will report back with results tomorrow.

0 Kudos