Business Applications, Model-driven, PowerApps

PowerApps Dataflow: is your CDS entity primary field name exactly the same as an entity name? Well, don’t.

The Issue:

Unable to load data to the existing custom entity on CDS from CSV or Excel via Dataflow.

We renamed the primary Name field for our custom entity and this is how it’s all started.

Error:

Load to Common Data
Service failed. Details: Bad Request
{"error":{"code":"0x0","message":"An
error occurred while validating input parameters:
Microsoft.OData.ODataException: Does not support untyped value in non-open
type.\r\n at
System.Web.OData.Formatter.Deserialization.DeserializationHelpers.ApplyProperty(ODataProperty
property, IEdmStructuredTypeReference resourceType, Object resource,
ODataDeserializerProvider deserializerProvider, ODataDeserializerContext
readContext)\r\n at
System.Web.OData.Formatter.Deserialization.ODataResourceDeserializer.ApplyStructuralProperties(Object
resource, ODataResourceWrapper resourceWrapper, IEdmStructuredTypeReference
structuredType, ODataDeserializerContext readContext)\r\n at
Microsoft.Crm.Extensibility.CrmODataEntityDeserializer.ApplyStructuralProperties(Object
resource, ODataResourceWrapper resourceWrapper, IEdmStructuredTypeReference
structuredType, ODataDeserializerContext readContext)\r\n at System.Web.OData.Formatter.Deserialization.ODataResourceDeserializer.ReadResource(ODataResourceWrapper
resourceWrapper, IEdmStructuredTypeReference structuredType,
ODataDeserializerContext readContext)\r\n at
System.Web.OData.Formatter.ODataMediaTypeFormatter.ReadFromStream(Type type,
Stream readStream, HttpContent content, IFormatterLogger
formatterLogger)","innererror":{"message":"An
error occurred while validating input parameters:
Microsoft.OData.ODataException: Does not support untyped value in non-open
type.\r\n at
System.Web.OData.Formatter.Deserialization.DeserializationHelpers.ApplyProperty(ODataProperty
property, IEdmStructuredTypeReference resourceType, Object resource,
ODataDeserializerProvider deserializerProvider, ODataDeserializerContext
readContext)\r\n at
System.Web.OData.Formatter.Deserialization.ODataResourceDeserializer.ApplyStructuralProperties(Object
resource, ODataResourceWrapper resourceWrapper, IEdmStructuredTypeReference
structuredType, ODataDeserializerContext readContext)\r\n at Microsoft.Crm.Extensibility.CrmODataEntityDeserializer.ApplyStructuralProperties(Object
resource, ODataResourceWrapper resourceWrapper, IEdmStructuredTypeReference
structuredType, ODataDeserializerContext readContext)\r\n at
System.Web.OData.Formatter.Deserialization.ODataResourceDeserializer.ReadResource(ODataResourceWrapper
resourceWrapper, IEdmStructuredTypeReference structuredType,
ODataDeserializerContext readContext)\r\n at
System.Web.OData.Formatter.ODataMediaTypeFormatter.ReadFromStream(Type type,
Stream readStream, HttpContent content, IFormatterLogger
formatterLogger)","type":"Microsoft.Crm.CrmHttpException","stacktrace":"
at
Microsoft.Crm.Extensibility.OData.CrmODataUtilities.ValidateInputParameters(ModelStateDictionary
controllerModelState)\r\n at Microsoft.Crm.Extensibility.OData.EntityController.PostEntitySetImplementation(String&
entitySetName, EdmEntityObject entityObject)\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()"}}}.
(Job ID: f5780a7d-bf8a-41e0-9a1b-4a1e5bc64ac7)

Testing 1 . Trying to load data to a new entity … It doesn’t like that entity name is the same as a primary field name, apparently.

Testing 2. Let’s change the entity name

Test 2. Rename a primary field. Trying to load data to the existing entity

The conclusion

After the 2 weeks long conversation with the support team this is your available solution: don’t name your primary field the same way you named your CDS custom entity. You will not be able to use import via Dataflow!

4 thoughts on “PowerApps Dataflow: is your CDS entity primary field name exactly the same as an entity name? Well, don’t.”

    1. Did you try it just recently? Is it still the issue? I may check it with the product team if this is the case. Is it possible for you to tell me more about your issue ? I don’t remember how we solved it at the time. But I am working with Dataflow a lot at the moment so happy to revisit it.

      Like

      1. Sorry for double comment.

        No – I did not try it, as it has always been one of those supposed to be impossible, but don’t look in customizatons.xml tasks.

        My issue is somewhat similar – I have a few entities that have the same name as their primary field name. When I try to report on these entities in Power BI, if I pull them in as Entity objects, the primary field is not there, if I pull them as System objects, it is there renamed as something like CustomEntity1. I need the data as entity objects, so I’ve pulled the tables as both types and merged the tables (which is actually a useful thing in itself).
        Your issue freaked me out a little, as I was concerned that I would not be able to connect to one of these entities for a Dataflow, if I need to in the future – I was able to, so it looks like the issue you discovered is resolved.

        Like

Leave a comment