ITA Business Rules – try this if you wanted to set up advanced server-side validation rules

By | July 13, 2023

These are not the same business rules you are used to in Dataverse – these are relying on the plugins and FetchXML, so, technically, there is nothing new since we’ve been using plugins forever. However, the cool thing about them is that:

  • You can use them to run validations when creating/updating records
  • Those validations are relying on the configurable FetchXML queries, so these rules can be used for advanced duplicate validation among other things
  • And you don’t need to write those plugins – instead, you can use a Canvas App to configure the rules

Everything is in git, and you’ll find plugin source codes, as well as solution sources (and solution packages) here: https://github.com/ashlega/ITAintBoring.AdvancedDuplicateDetection

The diagram below explains how to use those solutions:

There are two solutions to deploy in the dev environment, but only one of those needs to be deployed in the destination environments. Once it’s done, you can use business rules admin app to create new business rules in the dev environment – those will show up in the dev dev environment as SDK Message Processing Steps.

Once you have tested them, add them to your own solution, export from dev, and import to the destination.

Here is an example:

There is an admin app in the ITA Business Rules solution you can use to create those rules:

It is not a plugin registration utility, but it does similar things:

For example, let’s say you wanted to add a new business rule:

In the example above, once that configuration is saved, a new SDK Message Processing step will be created in the system for the ITA DuplicationDetection plugin – here is how it will look like in the plugin registration tool (and this screenshot is only FYI. You don’t need to use plugin registration tool at all):

And, then, whenever a user decides to create a new account record in that environment, the plugin will kick in, it will use FetchXML to query data, and, if there is some data (or if there is no data, depending on the “Error When No Results” setting), it will display an error message:

Can it be improved? Absolutely:

  • It would be nice to have message translations added (to support different languages)
  • Might also make sense to add some support for Javascript validations (perhaps another Custom API?)
  • And I am not 100% sure it’s bug-free at this point – it just showed up and definitely requires testing

Either way, what about that FetchXML? You can use parameters there:

At the moment, the syntax is very simple – just add a field name from the “current record” and surround it with curly braces: {emailaddress1}

Note*: I suspect if the attribute is missing (as in, if that new account record did not have email column populated), this version may produce an unexpected error in some situations, but I’ll work on getting this resolved.

What else can you do there?

Last but not least, unless you wanted to look at the sources etc, you will need to import these two managed solutions from https://github.com/ashlega/ITAintBoring.AdvancedDuplicateDetection

As I mentioned earlier, “Runtime” solution need to be deployed in each environment, whereas the other one only need to be deployed in the development envrionment.

July 17 update: v1.01 has bee release – have a look at ITA Business Rules v1.01 post for the details

Leave a Reply

Your email address will not be published. Required fields are marked *