Boomi Tips: Business Rule with Child Records
In the last Boomi post, we discussed the usage of business rule shape in Boomi. Based on that, we all know that we can easily examine a document using the shape. But did you know that you can actually examine the child records in a document (e.g, XML or JSON) too? Let’s use the following sample for the demo:
<?xml version="1.0" encoding="UTF-8"?> <parent> <name>Wilma Flinstone</name> <email>email@example.com</email> <childs> <child> <name>Andy Flinstone</name> <email></email> </child> <child> <name>Cindy Flinstone</name> <email>firstname.lastname@example.org</email> </child> </childs> </parent>
In the process shape, I have configured to validate an email field on the child record (parent.childs.child.email).
After the execution, you can see that the business shape will loop through all child records and validate one by one. In this scenario, the first child failed and the second passed the rule.
Please be aware that when one of the child records fail, the whole document will be rejected.
So what if you just want to reject one of the child records that has invalid data? The easiest solution is to split the XML document using data process shape before sending the document to business rule shape.
However, you would need to do additional processing if you would like to join the document back together.