Skip to content

Commit 1a5869a

Browse files
Create TechTrekwithAJ-Automate Discovery using flow Script Step ReadME.md
1 parent aac7a27 commit 1a5869a

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
This script is used in ServiceNow to automate device discovery on a network by triggering Quick Discovery using a MID Server. It is typically used within a workflow or flow, where you want to scan a device using its IP address.
2+
It adds reliability by using two MID servers, so if one fails, the other is used as a backup.
3+
These are the two MID Servers that will be used to perform the discovery.
4+
You need to replace 'mid_server_1' and 'mid_server_2' with real MID Server names or sys_ids.
5+
This gives you a backup option if the first one fails.
6+
The script tries to get the IP address from the current record (current.ip_address).
7+
If that’s not available, it tries to use inputs.ip_address (passed into the script).
8+
If no IP address is found, it logs an error and stops.
9+
This is a helper function that tells ServiceNow to start Quick Discovery for a specific IP address using a specific MID Server.
10+
It first tries to start discovery using the first MID server.
11+
If it works, it logs a success message and updates the record to show that discovery was triggered using MID Server 1.
12+
If the first attempt fails, it logs a warning and tries again with the second MID server.
13+
If the second attempt also fails, it logs an error and updates the record to reflect that both attempts failed.
14+
The script updates the current record with the result of the discovery attempt (success or failure and which MID server was used).

0 commit comments

Comments
 (0)