ServiceNow ATF - Query Alert From Event, and Incident From Alert

Gerald Onyia
Kilo Guru

The Use Case I am trying to automate using ServiceNow ATF involves:

1. Creating an Event record with specific values (Record Insert into Event table {'em_event'}).

2. Validate that the new Event record contains an Alert number in the 'Alert' variable (Record Validation from Step 1).

This is now where I am stuck. I am trying to query a record from the Alert table ('em_alert') , whose [Alert.Number = Event.Alert]. I have tried 'Record Query', and 'Open Existing Record'. Both don't seem to work.

The next step would then be to query a record from the Incident table, whose [Incident.Number = Alert.Task], then validate a few variables within the Incident record.

The logic behind this is that an Alert is mapped to a new Event based on the input criteria of the Event. Then an Incident record is created from that Alert with specific pre-populated values.

Can anyone offer a solution or some advise? I would greatly appreciate it.

1 ACCEPTED SOLUTION

Gerald Onyia
Kilo Guru

So after some intense research, practice, and self-teaching, I figured it out 🙂 Basically, I needed to use 2 'Run Server Side Script' Test Steps for each call.

 

Test:

find_real_file.png

 

Test Result:

find_real_file.png

 

1st 'Run Server Side Script' Test Step:

find_real_file.png

 

2nd 'Run Server Side Script' Test Step:

find_real_file.png

For now, this is my best solution. However, if someone has a way to accomplish this with only one 'Run Server Side Script' Test Step, I would appreciate that.

View solution in original post

6 REPLIES 6

Brad Tilton
ServiceNow Employee
ServiceNow Employee

Could you show us the steps you've used so far with screenshots? I think you'll need to do a record query AND open existing record based on the record query.

Hi Brad,

 

This is what I have thus far...

 

 

And the result is...

 

 

I am trying to Query from em_alert, where Number = (Record Insert.Record.Alert), and then eventually Query from incident, where Number = Alert.Task.

 

Hope this information helps. I appreciate any advise or suggestion.

I hear a Server Side Script can be used to accomplish this?

I was able to accomplish this with a 'Run Server Side Script' Test Step. Feel free to view my Accepted Solution for information purposes. Thanks!