Mon, 05/31/2021 - 14:20 By Danny Rodrigue…

Bypass Dataverse Custom Plugin Execution:

Presentation

A need that is often experienced while working with Microsoft Dataverse is to update data in batch. When you have a lot of records to update and you like to get your hands dirty, building some C# batch is a great solution!

Then, you will face another problem. The data to be updated is known and it's already in line with you business logics. So there is no need to slow down the process by having plug-ins fired for each update. Therefore, one solution is too deactivate the plug-ins, but this requires an additional analysis and will prevent any user to used those plug-ins. If the data update last some hours, this is not acceptable for any business.

Luckily, there is a solution: BypassCustomPluginExecution !

By specifying this parameter on the request, all synchronous plug-ins and real-time workflows are disabled. Exception made for the plug-ins and workflows where Microsoft is the publisher.

Note that asynchronous plug-ins and workflows are not bypassed!

SDK

Individual requests

If you want to bypass custom logic only for some specific SDK methods, you can do so by adding the BypassCustomPluginExecution parameter to your methods. For example when creating a new account:

var createRequest = new CreateRequest
{
    Target = account
};
createRequest.Parameters.Add("BypassCustomPluginExecution", true);

svc.Execute(createRequest);

Be careful, this only works with Execute methods. For example, Create or Update methods will not accept this parameter.

All SVC requests

The BypassCustomPluginExecution can be added directly to the CrmServiceClient object.

var svc = new CrmServiceClient(conn);

svc.BypassPluginExecution = true;

By doing so, all requests made with this instance of the Svc object will bypass plug-ins and workflows.

Web API

Nothing more easy: just add a parameter to your header request!

POST https://yourorg.api.crm4.dynamics.com/api/data/v9.1/accounts HTTP/1.1
MSCRM.BypassCustomPluginExecution: true
Authorization: Bearer ***
Content-Type: application/json
Accept: */*

{
  "name":"Test Account"
}

Or if you're a postman addict:

Bypass Dataverse Custom Plugin Execution

Security privilege

To be able to run to use the BypassCustomPluginExecution parameter, the user logged in must have the prvBypassCustomPlugins privilege. By default, only users with the system administrator security role have this privilege.

You can add it to any user, but only via code! Either Web API or SDK. Microsoft's documentation covers it perfectly.

Source

Bypass Dataverse Custom Plugin Execution

Add new comment

Image CAPTCHA
Enter the characters shown in the image.