How to Set up a Proper Validation Logic for B2B Data Interchange

Setting up message validation logic is a burden. Specifying and fine-tuning logic with required constraints can take weeks, especially when your interchange is based on cross-industry standards like EDIFACT or UBL. For example, a validation artifact (Schematron) for a UBL invoice message, covering the requirements of the EU eInvoicing Directive, includes around 1000 test assertions.

Detailed low-speed work is expensive, and naturally, you want to try and cut back on costs. Rushing with validation logic can backfire badly, though. You might end up wondering how on Earth it is possible that you constantly have quality issues. Somehow, erroneous data pass your validation. Why?

The following tips help you to set up a proper validation logic with more ease.


Do Not Embed Validation Logic Into Application Code

When validation logic is embedded in an application or a mapping tool, manual coding is usually involved. It means maintenance, updates, general mastering of the code, read: extremely high costs, and person dependence.

Updating embedded validation logic requires retesting the application as well. It is also difficult to reuse your code. Consider separating the validation and application logic into their own entities. This will enable an easier and faster update, independent of application updates, and the possibility to apply the logic to other use cases. If at some point desired, this also facilitates the update or switch of application.

Get Proper Tools to Auto-Generate the Validation Logic

It is an endless task to manually code the validation logic, so make sure you have access to a visual UI that helps you to set up most requirements using a no-code/low-code editor. Automatically generated validation logic is much easier to manage and modify than a manually written one. At best, the same tool is shared with multiple teams, which helps to unify the implementation of validation rules. Centralizing them in a shared environment enables full transparency.

Make Sure You Can Reuse the Existing Validation Logic

It may seem impossible to reuse validation logic for individual messages because they just are “so different”. But actually, there are quite a few general conditions that they need to pass, like your business rules. Also, some case-specific conditions might occur in more than one message. Aim for a situation where you are able to copy-paste or import chunks of your validation logic from one validator to the other to speed things up.

The Validation Logic Is Only as Good as Your Documentation

Message implementation Guidelines (MIG’s) are often inaccurate. Creating and maintaining your validation logic can feel like a never-ending task – time and time again updating validation rules. It is never just one iteration. And in the worst case, every change in validation rules leads to an application update.

Generate the documentation and the validation logic from the same source code with the same tool to remove the iteration need. It will considerably cut down your workload. You will save time and effort, and cut down unnecessary stress on yourself and your team of experts.


Learn more about Truugo Subset Editors at