Import 3rd party data into CMDB via Flow Designer and IRE

Kenneth3
Tera Guru

Hi,

I want to import hardware data from a 3rd party and import that into the CMDB (cmdb_ci_computer) table of ServiceNow. For this I am using IntegrationHub in Flow Designer. I have created a REST call to the 3rd party application and used the JSON parser to parse the incoming data. The challenge for me now is to really import and transform the data to the target table (cmdb_ci_computer). I have read that the best approach is to use the IRE (Identification and Reconciliation) module. Does anyone have done this already or give me some best practices how to do this within Flow Designer?

find_real_file.png

Thanks in advance.

7 REPLIES 7

Sai Kumar B
Mega Sage
Mega Sage

@Kenneth 

1.) You can build custom action with IRE API code to process the JSON payload

2.) Attach the action after For each and pass each payload to the custom action

 

Payload sample format

var payload = {
  items: [{
    className:'<<CLASS_NAME>>',
    values: {
      name: '<<CI_NAME>>',
      serial_number:'<<CIs_Serial_NUMBER>>’
    }
  }]
};

IRE API Code

/* Replace the variable as below:
YOUR_COPIED_CI_PAYLOAD: This is the payload we copied from step#1 OR your generated payload. 
YOUR_DATA_SOURCE: Replace this with your intended data source like ServiceNow, SCCM, ImportSet, etc.

*/



runCiIdentificationReconciliation();

function runCiIdentificationReconciliation() {
   var payload  = YOUR_COPIED_CI_PAYLOAD; //Place each iteration payload here
   var input = new JSON().encode(payload);
   var output = SNC.IdentificationEngineScriptableApi.createOrUpdateCIEnhanced('YOUR_DATA_SOURCE', input,{});
   // If you dont wanted to use the Enhanced IRE engine you can replace the above line with below:
   // var output = SNC.IdentificationEngineScriptableApi.createOrUpdateCI('YOUR_DATA_SOURCE', input);

}

Reference - [CMDB IRE] How to run the CI identification on-demand using the payload

 

 

Hi Sai Kumar,

Can you elaborate a little bit more of the exact steps that you are talking about?

1.) You can build custom action with IRE API code to process the JSON payload

2.) Attach the action after For each and pass each payload to the custom action

The above steps are still a little bit unclear to me.

Regards,

@Kenneth 

1.) Build sub-flow with custom action/spoke with the above code I pasted

2.) Call the sub-flow to your flow designer after forEach item and pass the payload as an input

3.) The IRE API code will process the CI upon passing JSON payload as input

4.) You can find more information on IRE API from the below link

Reference - [CMDB IRE] How to run the CI identification on-demand using the payload

I was hoping to do something similiar, build a custom action where you'd have three inputs, a field to select the Class, the Discovery source, and a Field/Value input that would let you map the fields from your source into the class.  A simple script could then take it through the IRE and return the record/result.

 

My issue is I can't seem to find a field type for the Field/Values.  Do you know if there is an OOB Action Input type that can be used for this?