SM version: 9.71
uCMDB version: 2019.11
Using the out of the box push functions, there is an option for CI fields mapped to SM called Ignore on Null. But that is not working and there is a QCCR (QCCR1E119141) which has been defferred.
But I think it might be possible to call the SMUtils.isEmpty(str) function from the /scripts/SM PushFunctions.groovy:
/**
* Check the input is empty, if a string, check "" and "null"
*
* @param str input an object
* @return true/false, return true if empty or else return false
*/
public static boolean isEmpty(def str) {
return SMUtils.isEmpty(str);
}
Question: how do I call this function from the XML mapping? Can I swap the "true" below and somehow call the isEmpty function?
<?xml version="1.0" encoding="UTF-8"?>
<integration xmlns:xsi="">www.w3.org/.../XMLSchema-instance" xsi:noNamespaceSchemaLocation="../mappings_schema.xsd">
<info>
<source name="UCMDB" vendor="HP" version="10.20"/>
<target name="SM" vendor="HP" version="9.40"/>
</info>
<import>
<scriptFile path="mappings.scripts.SMPushFunctions"/>
</import>
<!--
Push uCMDB CIT to SM Business Service.
-->
<target_entities>
<source_instance query-name="SM Business Service Push 2.0" root-element-name="Root">
<target_entity name="bizservice">
<target_mapping datatype="STRING" name="UCMDBId" value="Root['global_id']"/>
<target_mapping datatype="STRING" name="CustomerId" value="'DEFAULT'"/>
<target_mapping datatype="STRING" name="Type" value="'bizservice'"/>
<target_mapping datatype="STRING" name="Subtype" value="SMPushFunctions.getSMSubType(Root['element_type'],ClassModel,'BizService')"/>
<target_mapping datatype="STRING" name="ServiceProvider" value="Root['provider']"/>
<target_mapping datatype="STRING" name="ServiceName" value="Root['name']"/>
<target_mapping datatype="STRING" name="DisplayName" value="Root['display_label']"/>
<target_mapping datatype="STRING" ignore-on-null="false" name="Comments" value="Root['comment']"/>
</target_entity>
</source_instance>
</target_entities>
</integration>