Hi,
I have a question regarding the use of the BypassCustomPluginExecution option.
The scenario is the following:
– I have a custom entity called nc_test. This entity has one custom field nc_enddate.
– I have created a post-operation plugin for this entity that does something (for this case it’s not relevant what it does, only that it exists)
– The created plugin triggers on all attributes (no filtering attributes)
– Dynamics 365 On-Premise V9.1.7.5
Test 1 (works as expected)
Now when I perform the following code to update a record of the specified entity, I have verified that the plugin is indeed being bypassed.
var existingRecord = new Entity(“nc_test”, new Guid(“E101261B-623C-E911-8FDF-1860247C2220”));
existingRecord[“nc_enddate”] = new DateTime(2022, 8, 4);
var updateReq = new Microsoft.Xrm.Sdk.Messages.UpdateRequest();
updateReq.Target = existingRecord;
updateReq.Parameters[“BypassCustomPluginExecution”] = true;
crmContext.Execute(updateReq); //crmContext is an IOrganizationService object
Test 2 (plugin is not bypassed)
– I change the plugin to set the filtering attributes to nc_enddate, so it will only trigger when that field has changed.
– Then perform the exact same code as above:
var existingRecord = new Entity(“nc_test”, new Guid(“E101261B-623C-E911-8FDF-1860247C2220”));
existingRecord[“nc_enddate”] = new DateTime(2022, 8, 4);
var updateReq = new Microsoft.Xrm.Sdk.Messages.UpdateRequest();
updateReq.Target = existingRecord;
updateReq.Parameters[“BypassCustomPluginExecution”] = true;
crmContext.Execute(updateReq); //crmContext is an IOrganizationService object
This time however the BypassCustomPluginExecution option does not seem to work.
Does anyone know why this option only seems to work for plugins that have no filtering attributes?
And what would you recommend as a solution for this?
Thanks in advance.
Best regards,
Chris