TechTrekwithAJ_ITOM Discovery automate Via Workflow script#2398
Closed
TechTrekwithAJ wants to merge 6 commits intoServiceNowDevProgram:mainfrom
Closed
TechTrekwithAJ_ITOM Discovery automate Via Workflow script#2398TechTrekwithAJ wants to merge 6 commits intoServiceNowDevProgram:mainfrom
TechTrekwithAJ wants to merge 6 commits intoServiceNowDevProgram:mainfrom
Conversation
This code will help to populate the Manufacturer if that empty on CMDB_CI table
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. It adds reliability by using two MID servers, so if one fails, the other is used as a backup.
Contributor
|
Hello @TechTrekwithAJ Thank you for your contribution. This cannot be merged as this creates a new dummy path ITOM under code snippets. Please DO Not CREATE Duplicate folders. also, I have just noticed it's calling new Discovery (), but there is no script include and the method it's calling. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
It adds reliability by using two MID servers, so if one fails, the other is used as a backup.
Two MID servers are defined to run the discovery process, providing a fallback if the first one fails.
Replace 'mid_server_1' and 'mid_server_2' with actual MID server names or sys_ids.
The script fetches the IP address either from the current record (current.ip_address) or from the inputs.
If no IP address is available, it logs an error and exits.
A helper function is used to initiate Quick Discovery for a specific IP using a specified MID server.
It first attempts discovery using the first MID server.
If successful, it logs the success and updates the record with the status.
If it fails, it logs a warning and tries the second MID server.
If both attempts fail, it logs an error and marks the discovery as failed.
Finally, it updates the record with the outcome and the MID server used.