Hi everybody,
I hope you are well. I have an Dynamics 365 9.0.18.12 and have the Problem, that the Message for InvalidPluginExecutionException contains only on the connection Form HTLM Code in the error Message.
I registered the same Plugin on the contact Form and the message is right. See below picture
Error Message in Contact:
Error Message in Connection:
My Code:
if (context.InputParameters.Contains("Target") && context.InputParameters["Target"] is Entity) { // Obtain the target entity from the input parameters. Entity entity = (Entity)context.InputParameters["Target"]; // Obtain the organization service reference which you will need for // web service calls. IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory)); IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId); try { var owner = entity.GetAttributeValue("ownerid"); if (owner.LogicalName == "systemuser") { throw new InvalidPluginExecutionException(OperationStatus.Canceled); } } catch(InvalidPluginExecutionException ex) { throw new InvalidPluginExecutionException("Heute war ein guter Tag.", ex); } }
Anybody an Idea how can i fix it?
Thanks for help.