Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How can we prevent Duplicate CI for Name+Serial Number IRE combination

Suvetha S
Tera Contributor

Hi All,

 

We have changed the OOB IRE rule for Server table to look for Name + Serial Number combination. So if a server comes in with a matching Serial Number and Name IRE will update the existing records. In certain cases, Discovery couldn't fetch the serial number from the target servers and IRE is creating a duplicate CI. One CI - Name & Empty Serial Number, second CI- Same name with Serial number value. Initially we thought of entering serial number values for cmdb_serial_number manually to avoid the issue, but it didn't work as expected. Whenever Discovery is bringing empty serial number its creating a duplicate in the system. Any suggestions will be helpful. 

10 REPLIES 10

newhand
Mega Sage

@Suvetha S

Maybe it's a bug about Discovery. 

What about collecting all the logs and raise an HI CASE..

 

And what I can suggest is to create a trigger (before insert) and check if the CI has both a name and a Serial Number. If the Serial Number is missing, reject the insert action and store the CI information in a custom table or raise an email to notify the team.

 

 

Please mark my answer as correct and helpful based on Impact.

Hi @newhand Thanks for your response, How can we create a trigger? I do not have any idea about it

@Suvetha S 
To create a business rule , you can refer this link。
https://docs.servicenow.com/bundle/sandiego-api-reference/page/script/business-rules/concept/c_Busin... 

 

Basically,

  1. Define a trigger.

  2. Specify some conditions.

  3. Write your logic script.
     And here, you can use the code below to reject the insert.

current.setAbortAction(true);

 

Please mark my answer as correct and helpful based on Impact.

Amit Gujarathi
Giga Sage
Giga Sage

HI @Suvetha S ,
I trust you are doing great.
To address the issue of duplicate Configuration Items (CIs) being created in ServiceNow due to missing serial numbers, the suggestion to create a business rule (before insert trigger) is a practical approach. This business rule can check whether both the name and serial number are present for a CI. If the serial number is missing, the rule can either reject the insertion of the CI or take alternative actions like logging the information or sending a notification.

if (!current.serial_number) {
    current.setAbortAction(true);
    // Optionally, add code here to log the information or send notifications
}

Was this answer helpful?


Please consider marking it correct or helpful.


Your feedback helps us improve!


Thank you!


Regards,


Amit Gujrathi