I have a custom plugin which is triggered when a contact gets added to a navigation property of another custom entity. Within this plugin I check a few conditions and then execute an AddMemberListRequest for the contact.
This plugin works when a contact gets added via the Dynamics 365 web interface AND when a contact gets added via the .net Framework Microsoft.Xrm.Sdk.IOrganizationService.
However, when I add a contact via the rest api (Odata), the plugin is triggered but throws:
Microsoft.Xrm.Sdk.InvalidPluginExecutionException: OrganizationServiceFault System.ServiceModel.FaultException`1[Microsoft.Xrm.Sdk.OrganizationServiceFault]: The 'Create' method does not support entities of type 'listmember'. (Fault Detail is equal to Exception details:
ErrorCode: 0x80040800
Message: The 'Create' method does not support entities of type 'listmember'.
TimeStamp: 2020-07-08T16:40:40.1979569Z
--
). ---> Microsoft.Xrm.Sdk.InvalidPluginExecutionException: OrganizationServiceFault System.ServiceModel.FaultException`1[Microsoft.Xrm.Sdk.OrganizationServiceFault]: The 'Create' method does not support entities of type 'listmember'. (Fault Detail is equal to Exception details:
ErrorCode: 0x80040800
Message: The 'Create' method does not support entities of type 'listmember'.
TimeStamp: 2020-07-08T16:40:40.1979569Z
--
).
at Microsoft.Dynamics.Marketing.Plugins.MarketingPluginBase.Execute(IServiceProvider serviceProvider)
at Microsoft.Crm.Extensibility.V5PluginProxyStep.ExecuteInternal(PipelineExecutionContext context)
at Microsoft.Crm.Extensibility.VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)
--- End of inner exception stack trace ---
at Microsoft.Crm.Extensibility.VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)
at Microsoft.Crm.Extensibility.PipelineInstrumentationHelper.Execute(Boolean instrumentationEnabled, String stopwatchName, ExecuteWithInstrumentation action, PipelineExecutionContext context)
at Microsoft.Crm.Extensibility.Pipeline.<>c__DisplayClass2_1.<Execute>b__0()
Just to reiterate, I am not using a Create method in a listmember, I am executing an AddMemberListRequest. The same exact plugin code runs for each trigger but only throws the exception when triggered via the rest api.
EDIT: One more detail is that the plugin also works when a single rest api call is made associating a contact with the other custom entity. The scenario in which the plugin does not work is that it is triggered via an Odata batch request
I'm not sure if this is a bug but clearly there is something different about the context under which the plugin runs when triggered via rest api. I dont really know how to submit a bug report if this is, in fact, a bug.
Does anyone have any suggestions?
Thanks
I'm running version 1612 (9.0.15.9) on-premises.
I have tried remote debugging but cant see any differences while doing so since I am not able to step into any of the relevant code.