Sample Integration Population Query

The following image displays a sample query “SNOW Biz Containment Biz 1.0” to be populated from ServiceNow:

Note that relationships are marked as Root, so in this case every Root element contains a pair of CIs, parent and child.

The following mapping file is created ServiceNowGenericAdapter/mappings/population/SNOW Biz Containment Biz 1.0.xml, and this is how it looks like in XML format:

<target_entities>
    <source_instance query-name="SNOW Biz Containment Biz 1.0" root-element-name="cmdb_rel_ci">
<target_entity is-valid="cmdb_rel_ci['parent_table'] == 'cmdb_ci_service'" name="BusinessService"> <target_mapping datatype="STRING" name="global_id" value="cmdb_rel_ci['parent']"/>
</target_entity>
<target_entity is-valid="cmdb_rel_ci['parent_table'] == 'cmdb_ci_appl'" name="BusinessApplication">
<target_mapping datatype="STRING" name="global_id" value="cmdb_rel_ci['parent']"/>
</target_entity>
<target_entity is-valid="cmdb_rel_ci['child_table'] == 'cmdb_ci_service'" name="BusinessService_1">
<target_mapping datatype="STRING" name="global_id" value="cmdb_rel_ci['child']"/>
</target_entity>
<target_entity is-valid="cmdb_rel_ci['child_table'] == 'cmdb_ci_appl'" name="BusinessApplication_1">
<target_mapping datatype="STRING" name="global_id" value="cmdb_rel_ci['child']"/>
</target_entity>
</source_instance> ...

Note how the structure of the mapping file follows the hierarchy in the TQL query, relationship as a Root, CIs on both ends.

You can limit the processing the result from the ServiceNow table cmdb_ci_rel by defining is-valid condition. In this example is-valid="cmdb_rel_ci['parent_table'] == 'cmdb_ci_service'", it checks if the value is coming from the cmdb_ci_service table.