cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Regular Visitor

CDS filtering expression by specific ownerid

Hello,

I'm trying to create flow for dynamics 365 (CDS Current environment connector), which should fire if record is assigned to specific user.

I can't set filterexpression - every filter gives bad request error - Exception parsing _ownerid_value eq .......

Tried these ones:

_ownerid_value eq GUID1 or _ownerid_value eq GUID2

_ownerid_value eq GUID1

_ownerid_type eq systemusers and (_ownerid_value eq GUID1 or _ownerid_value eq GUDI2)

 

Even to check I set the filter as statecode eq 0 as it shown here but got the same result. Could you please help to set the filter correctly.

If I remove filter, the flow works.

flow.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Found the workaround, but initial problem looks like a bug.

 

In the settings of trigger I added two trigger conditions:

1) @or(equals(triggerOutputs()?['body/_ownerid_value'], '33a85ad4-6ba4-4bed-99ea-ef6416c2cb12'), equals(triggerOutputs()?['body/_ownerid_value'], '84c0b005-92e9-e811-a967-000d3ab49764'))

2) @equals(triggerOutputs()?['body/_ownerid_type'], 'systemusers') 

View solution in original post

3 REPLIES 3
Highlighted
Community Support
Community Support

 

Hi @scr1pt ,

 

You need to add single quotes outside the guid, please take a try again.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted

Hi, @v-bacao-msft 

The same result.

Spoiler
{
  "error": {
    "code""0x80040203",
    "message""Exception parsing _ownerid_value eq '33a85ad4-6ba4-4bed-99ea-ef6416c2cb12' or _ownerid_value eq '84c0b005-92e9-e811-a967-000d3ab49764' submitted for attribute filterexpression of callback registration. Target entity: kc_accountcontact. Exception: System.InvalidOperationException: AttributeTypeCode not valid:Virtual\r\n   at Microsoft.Crm.ObjectModel.CallbackRegistrationTypeMapFactory.Get(AttributeMetadata attributeMetadata, EntityMetadata entityMetadata)\r\n   at Microsoft.Xrm.Sdk.Data.CodeGen.ClassTypeFactory.BuildType(String logicalName, IDictionary`2 entityMetadata, IDictionary`2 types)\r\n   at Microsoft.Xrm.Sdk.Data.CodeGen.ClassTypeFactory.Create(IEnumerable`1 entityMetadata)\r\n   at Microsoft.Crm.ObjectModel.EdmModelBuilder.BuildClrType()\r\n   at Microsoft.Crm.ObjectModel.EdmModelBuilder..ctor(EntityMetadata xrmMetadata, IOrganizationContext context, ILogger logger)\r\n   at Microsoft.Crm.ObjectModel.CallbackRegistrationEdmModelCacheItem.GetOrBuildEdmModel(EntityMetadata xrmMetadata, IOrganizationContext context, ILogger logger)\r\n   at Microsoft.Crm.ObjectModel.EdmModelEvaluator..ctor(IOrganizationContext context, EntityMetadata xrmMetadata, Entity entityData)\r\n   at Microsoft.Crm.ObjectModel.CallbackRegistrationService.<>c__DisplayClass30_1.<ValidateInputEntity>b__0()\r\n   at System.Lazy`1.CreateValue()\r\n   at System.Lazy`1.LazyInitValue()\r\n   at Microsoft.Crm.ObjectModel.CallbackRegistrationService.ValidateInputEntity(IBusinessEntity entity, ExecutionContext context, IFeatureDetailContainer featureDetailContainer)",
    "innererror": {
      "message""Exception parsing _ownerid_value eq '33a85ad4-6ba4-4bed-99ea-ef6416c2cb12' or _ownerid_value eq '84c0b005-92e9-e811-a967-000d3ab49764' submitted for attribute filterexpression of callback registration. Target entity: kc_accountcontact. Exception: System.InvalidOperationException: AttributeTypeCode not valid:Virtual\r\n   at Microsoft.Crm.ObjectModel.CallbackRegistrationTypeMapFactory.Get(AttributeMetadata attributeMetadata, EntityMetadata entityMetadata)\r\n   at Microsoft.Xrm.Sdk.Data.CodeGen.ClassTypeFactory.BuildType(String logicalName, IDictionary`2 entityMetadata, IDictionary`2 types)\r\n   at Microsoft.Xrm.Sdk.Data.CodeGen.ClassTypeFactory.Create(IEnumerable`1 entityMetadata)\r\n   at Microsoft.Crm.ObjectModel.EdmModelBuilder.BuildClrType()\r\n   at Microsoft.Crm.ObjectModel.EdmModelBuilder..ctor(EntityMetadata xrmMetadata, IOrganizationContext context, ILogger logger)\r\n   at Microsoft.Crm.ObjectModel.CallbackRegistrationEdmModelCacheItem.GetOrBuildEdmModel(EntityMetadata xrmMetadata, IOrganizationContext context, ILogger logger)\r\n   at Microsoft.Crm.ObjectModel.EdmModelEvaluator..ctor(IOrganizationContext context, EntityMetadata xrmMetadata, Entity entityData)\r\n   at Microsoft.Crm.ObjectModel.CallbackRegistrationService.<>c__DisplayClass30_1.<ValidateInputEntity>b__0()\r\n   at System.Lazy`1.CreateValue()\r\n   at System.Lazy`1.LazyInitValue()\r\n   at Microsoft.Crm.ObjectModel.CallbackRegistrationService.ValidateInputEntity(IBusinessEntity entity, ExecutionContext context, IFeatureDetailContainer featureDetailContainer)",
      "type""System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]",
      "stacktrace""   at Microsoft.Crm.Extensibility.OrganizationSdkServiceInternal.CreateInternal(Entity entity, InvocationContext invocationContext, CallerOriginToken callerOriginToken, WebServiceType serviceType, Boolean checkAdminMode, Dictionary`2 optionalParameters)\r\n   at Microsoft.Crm.Extensibility.OData.CrmODataExecutionContext.CreateOrganizationResponse(Entity entity)\r\n   at Microsoft.Crm.Extensibility.OData.CrmODataServiceDataProvider.CreateEdmEntity(CrmODataExecutionContext context, String edmEntityName, EdmEntityObject entityObject, Boolean isUpsert)\r\n   at Microsoft.Crm.Extensibility.OData.EntityController.PostEntitySetImplementation(String& entitySetName, EdmEntityObject entityObject)\r\n   at Microsoft.Crm.Extensibility.OData.CrmODataUtilities.<>c__DisplayClass10_0`2.<InvokeActionAndLogMetric>b__0()\r\n   at Microsoft.PowerApps.CoreFramework.ActivityLoggerExtensions.Execute[TResult](ILogger logger, EventId eventId, ActivityType activityType, Func`1 func, IEnumerable`1 additionalCustomProperties)\r\n   at Microsoft.Xrm.Telemetry.XrmTelemetryExtensions.Execute[TResult](ILogger logger, XrmTelemetryActivityType activityType, Func`1 func)\r\n   at lambda_method(Closure , Object , Object[] )\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters)\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()"
    }
  }
}
Highlighted

Found the workaround, but initial problem looks like a bug.

 

In the settings of trigger I added two trigger conditions:

1) @or(equals(triggerOutputs()?['body/_ownerid_value'], '33a85ad4-6ba4-4bed-99ea-ef6416c2cb12'), equals(triggerOutputs()?['body/_ownerid_value'], '84c0b005-92e9-e811-a967-000d3ab49764'))

2) @equals(triggerOutputs()?['body/_ownerid_type'], 'systemusers') 

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Top Solution Authors
Top Kudoed Authors
Users online (14,105)