Skip to content

Commit 6b86e39

Browse files
Create TechTrekwithAJ-AutoPopulateMissingManufacturerReadME.md
This script is used in ServiceNow to automatically fill in the missing manufacturer information for Configuration Items (CIs) in the CMDB (Configuration Management Database).
1 parent a3e54e0 commit 6b86e39

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
This script is used in ServiceNow to automatically fill in the missing manufacturer information for Configuration Items (CIs) in the CMDB (Configuration Management Database).
2+
3+
1. Predefined Mapping:
4+
The script starts with a list of known model names and their corresponding manufacturer names.For example, a model called ThinkPad T14 is made by Lenovo, and MacBook Pro 16 is made by Apple
5+
2. Look Up Manufacturer:
6+
* It defines a function that looks up the manufacturer’s record in the core_company table (based on the name) and gets its unique ID (sys_id).
7+
3. Find CIs Missing a Manufacturer:
8+
* The script goes through all CIs in the cmdb_ci table where the manufacturer field is empty.
9+
4. Update Missing Manufacturer:
10+
* For each of those CIs:
11+
* It checks the model name.
12+
* If the model is in the predefined mapping:
13+
* It looks up the correct manufacturer in the core_company table.
14+
* It updates the CI record by setting the manufacturer field with the correct sys_id.
15+
* It also logs that the update was successful.
16+
* If the manufacturer is not found in the system, it logs a warning.
17+
5. Final Log:
18+
* After going through all matching CIs, it logs how many records were successfully updated.

0 commit comments

Comments
 (0)