Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

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

Gerald Onyia
Kilo Guru

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.

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.