How to call CMDB IRE when creating CI using Flow?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2024 02:30 AM - edited 09-19-2024 12:54 AM
We have built catalog items and it has variables like Name, serial number, OS, RAM etc. Once the user submits it the catalog item, the FLOW will get executed and creates/updates the CMDB.
We dont want to give direct/write access to CMDB tables and we have DECIDED to go with this approach.
Now, to avoid the duplicates, we need to make use of the CMDB IRE in the FLOW. How to do it?
Looking for steps to implement the same.
Thanks in advance!!!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2024 04:31 AM
Create an action with custom script and call the same in Flow
Thanks,
Narsing

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2024 07:31 AM - edited 11-30-2024 07:34 AM
@Suggy - Check in this way. First use "Identification Simulation" and try to generate a test payload on the CMDB table that you are going to update. Take that payload and pass the payload attribute values from the catalog item variables in your flow (i.e. create an action and use script over there and call the same action in your flow). Here is an example
var payload = {
"items" : [ {
"className" : "cmdb_ci_win_server",
"values" : {
"sys_class_name" : "cmdb_ci_win_server",
"serial_number" : "KB1284595 Test Server",
"ip_address" : "10.229.13.28",
"name" : "CS6476368 TEST2 Server"
}
},
{
"className" : "cmdb_ci_ip_address",
"values" : {
"ip_version" : "4",
"install_status" : "1",
"netmask" : "255.255.255.0",
"ip_address" : "10.0.0.1",
"sys_class_name" : "cmdb_ci_ip_address"
}
}, {
"className" : "cmdb_ci_network_adapter",
"values" : {
"dhcp_enabled" : "False",
"install_status" : "1",
"netmask" : "255.255.255.0",
"mac_address" : "00:aa:bb:cc:dd:ee",
"name" : "KB1284595 Test NIC",
"ip_address" : "10.0.0.1",
"ip_default_gateway" : "10.0.0.254",
"sys_class_name" : "cmdb_ci_network_adapter"
}
} ],
"relations" : [ {
"type" : "Owns::Owned by",
"child" : 2,
"parent" : 0
}, {
"type" : "Owns::Owned by",
"child" : 1,
"parent" : 2
}, {
"type" : "Owns::Owned by",
"child" : 1,
"parent" : 0
} ],
"references" : [ {
"referenceField" : "cmdb_ci",
"referenceDirection" : "childToParent",
"child" : 2,
"parent" : 0
}, {
"referenceField" : "nic",
"referenceDirection" : "childToParent",
"child" : 1,
"parent" : 2
} ],
"mainCiType" : "cmdb_ci_win_server"
};
var input = JSON.stringify((payload));
var output = sn_cmdb.IdentificationEngine.createOrUpdateCIEnhanced('ServiceNow', input, {});
gs.info(JSON.stringify(JSON.parse(output), null, 2));
Note: You need to modify the payload & Discovery source as per your requirement.
Thanks,
Narsing
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2024 10:51 AM
For anyone looking for an answer here, there's no out of the box flow action for doing this that I'm aware of. Most people bring CIs into the CMDB via a process like Discovery or ACC which both use the IRE inherently. For ETL type transactions, IntegrationHub ETL is the solution. In the days before IntegrationHub ETL was created, there is a class called CMDBTransformUtil which can be used with import sets and transform maps.
In this specific use case, the ask is for a catalog item which triggers a workflow to hook into the IRE. The best method I'm aware of is to use one of the following two classes in a script step depending on whether your app is scoped or not: