Virtual Connectors in Dataverse Not Rollback When Got Error On PostOperation-Sync

Do you know that we have the Virtual Connectors in Dataverse (Preview) solution in the AppSource that can let us configure and create Virtual Entity easily? We can do the CRUD (Create-Read-Update-Delete) operation directly (I tried the SQL Server connection) and it works perfectly as long as you set the Table design correctly. If you are interested in it, you can follow this link to implement it inyour trial environment.

As you know, in the Dataverse we have several Event Pipelines that we can apply to do customization in the selected table (I found the below picture from MS Learn Page that you can read here):

Dataverse Event Pipelines

In the picture above, we can set our Plugin to run on PreValidation, ***PreOperation,***and PostOperation(Sync and Async). In the Common Table (not Virtual Entity), when there is an error on PostOperation-Sync, the system will roll back all the transactions to the initial stage. Based on this, I tested how the Virtual Connectors in Dataverse work using the below code:

using Microsoft.Xrm.Sdk;
using System;

namespace DemoPlugin
{
    public class Plugin1 : IPlugin
    {
        public void Execute(IServiceProvider serviceProvider)
        {
            throw new InvalidPluginExecutionException("testing");
        }
    }
}

Then let's try updating the below data:

Initial Data

First, I register this Plugin in the PreOperation Pipeline. Then I go to the UI > Update the data > click Save (it will throw an error) and when checking from DB Level, the name is still 'T00000332-Test':

PreOperation testing

Next, I tried to change the Plugin to the PostOperation and change the data like the previous step. When click save, we will get the same error but in the Database, the name value has already changed:

PostOperation

Inspect in the DB and here is the result:

The name value already changed even though got an error

Hope it gives you information and Happy CRM-ing!

Leave a comment

Your comment is sent privately to the author and isn't published on the site.