Filtering attributes for DataVerse plugins registered on Create – How to execute them for specific field changes only.

Hello everyone and welcome to my blog. In today’s blog I will discuss about filtering attributes for Plugins on Create message in DataVerse/ Dynamics 365.

The blog will cover the following topics.

  1. How to trigger plugins on create for specific field changes
  2. How to specify filtering attributes for plugins on Create message in DataVerse/ Dynamics 365

Through my blog I share interesting tips and discuss on latest releases of Microsoft.NET technologies, Dynamics 365 and Power Platform, SharePoint and Client scripting libraries. Please subscribe to my blog to stay updated.

Traditionally in plugins, we always had the concept of filtering attributes for plugins registered on Update message. Filtering attributes are great in the sense they ensure that plugin is only triggered when specific field in filtering attribute changes.

However for plugins on Create message, there was no option to specify filtering attributes earlier. Check for the below illustration.

The latest version of Plugin registration tool support filtering attributes. Honestly I was not aware of this. But when I saw it, I thought to give it a try and check if it is working.

Below is an illustration of a plugin registered on Pre-create of a custom table. I have the option to add filtering attributes now.

As you observe from the above screenshot, I have selected Field1 and Field2 in the filtering attributes. So when I create a record of the custom table, the plugin should only fire if I enter value for Field1 or Field2.

The plugin code is very simple. All I am doing is throwing an exception back from the plugin.

Check for the outcome in the below illustration.

As you can see from the above video, my plugin on create executed only when I entered a value for Field1.

When I found filtering attributes enabled on Create message, I was not sure if this setting shall be respected. But looks like it is working.

Hope this helped. For similar interesting topics on Microsoft.NET and Power platform, please subscribe to my blog.

Debajit Dutta
Business Solutions MVP