Home > CRM > Dataverse | Bypass Custom Business Logic

Dataverse | Bypass Custom Business Logic

There are times when you want to be able to perform data operations without having custom business logic applied. Especially during complex data migration scenarios, we would not want our custom business logic (i.e., Sync Plug-ins/Real time Workflows) to be triggered.

The manual option to disable custom logic is,

  • We have to locate and disable the custom plug-ins. But this means that the logic will be disabled for all users while those plug-ins are disabled. It also means that you have to take care to only disable the right plug-ins and remember to re-enable them when you are done.

Now using BypassCustomPluginExecution option we can disable custom business logic programmatically.

About BypassCustomPluginExecution:

When you send requests that bypass custom business logic, all synchronous plug-ins and real-time workflows are disabled except:

  • Plug-ins which are part of the core Microsoft Dataverse system or part of a solution where Microsoft is the publisher.
  • Workflows included in a solution where Microsoft is the publisher.

There are two requirements:

  • You must send the API requests using the BypassCustomPluginExecution option.
  • The user sending the requests must have the prvBypassCustomPlugins privilege. By default, only System administrator’s have this privilege
    • The prvBypassCustomPlugins is not available to be assigned in the UI at this time. We can add a privilege to a security role using the API.

Using BypassCustomPluginExecution:

  • Web API:
    • Pass MSCRM.BypassCustomPluginExecution : true as a header in the request.
POST https://yourorg.api.crm.dynamics.com/api/data/v9.1/accounts HTTP/1.1
MSCRM.BypassCustomPluginExecution: true
Authorization: Bearer [REDACTED]
Content-Type: application/json
Accept: */*

  "name":"Test Account"
  • Organization Service:
    • Set BypassPluginExecution to true at the service, it will remain set for all requests sent using the service until it is set to false.
var svc = new CrmServiceClient(conn);

svc.BypassPluginExecution = true;

var account = new Entity("account")
    Attributes = {
        { "name", "Test Account" }

  • At Request class level:
    • BypassPluginExecution parameter, which is Optional, must be applied to each request individually.
    • You cannot use this with the 7 other IOrganizationService Methods, such as Create, Update, Delete.
    • You can use this method for data operations you initiate in your plug-ins.
var svc = new CrmServiceClient(conn);

var account = new Entity("account")
    Attributes = {
        { "name", "Test Account" }

var createRequest = new CreateRequest
    Target = account

createRequest.Parameters.Add("BypassCustomPluginExecution", true);


Adding the prvBypassCustomPlugins privilege to another role:

  • Because the prvBypassCustomPlugins is not available in the UI to set for different security roles, if you need to grant this privilege to another security role you must use the API.
  • The prvBypassCustomPlugins privilege has the id 148a9eaf-d0c4-4196-9852-c3a38e35f6a1 in every organization.
  • Code Snippet:
var roleId = new Guid(<id of role>);

    new Relationship("roleprivileges_association"),
    new EntityReferenceCollection {
            new EntityReference("privilege", new Guid("148a9eaf-d0c4-4196-9852-c3a38e35f6a1"))

Refer Docs article for more details.


  1. June 1, 2021 at 10:34 AM

    thanks Rajeev for this article

  1. June 1, 2021 at 10:39 AM
  2. June 15, 2021 at 5:04 PM

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: