I am using CRM2016
I created a test entity to replicate the issue
I did not do any customization on it. I created a new record with default fields and form. Then I tried to access the webapi for it
http://localhost/CRMDataBase/api/data/v8.0/new_test(bgcs0249-0a06-e611-941a-003002djlnc)
It worked fine and brought the record. Then I deleted the records and created a business process flow for it, with just one stage and one step
I activated it and added a new test record and tried to access the webapi url and it threw the below error
{ "error":{ "code":"","message":"Property 'stageid' is of an unrecognized EdmPropertyKind. Entity new_test has duplicate navigation property names. All property names (Navigation and Structural property) must be unique in an Entity ","innererror":{ "message":"Property 'stageid' is of an unrecognized EdmPropertyKind. Entity new_test has duplicate navigation property names. All property names (Navigation and Structural property) must be unique in an Entity ","type":"Microsoft.Crm.CrmHttpException","stacktrace":" at Microsoft.Crm.Extensibility.OData.CrmODataEntityTypeSerializer.CreateSelectExpandNode(EntityInstanceContext entityInstanceContext)\r\n at System.Web.OData.Formatter.Serialization.ODataEntityTypeSerializer.WriteEntry(Object graph, ODataWriter writer, ODataSerializerContext writeContext)\r\n
at System.Web.OData.Formatter.Serialization.ODataFeedSerializer.WriteFeed(IEnumerable enumerable, IEdmTypeReference feedType, ODataWriter writer, ODataSerializerContext writeContext)\r\n at Microsoft.Crm.Extensibility.OData.CrmODataFeedSerializer.WriteObject(Object graph, Type type, ODataMessageWriter messageWriter, ODataSerializerContext writeContext)\r\n at System.Web.OData.Formatter.ODataMediaTypeFormatter.WriteToStream(Type type, Object value, Stream writeStream, HttpContent content, HttpContentHeaders contentHeaders)\r\n at System.Web.OData.Formatter.ODataMediaTypeFormatter.WriteToStreamAsync(Type type, Object value, Stream writeStream, HttpContent content, TransportContext transportContext, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.WebHost.HttpControllerHandler.d__1b.MoveNext()","internalexception":{ "message":"Property 'stageid' is of an unrecognized EdmPropertyKind.","type":"Microsoft.OData.Core.ODataException","stacktrace":" at Microsoft.OData.Core.UriParser.Parsers.SelectPathSegmentTokenBinder.ConvertNonTypeTokenToSegment(PathSegmentToken tokenIn, IEdmModel model, IEdmStructuredType edmType, ODataUriResolver resolver)\r\n at Microsoft.OData.Core.UriParser.Visitors.SelectPropertyVisitor.ProcessTokenAsPath(NonSystemToken tokenIn)\r\n at Microsoft.OData.Core.UriParser.Visitors.SelectPropertyVisitor.Visit(NonSystemToken tokenIn)\r\n at Microsoft.OData.Core.UriParser.Parsers.SelectBinder.Bind(SelectToken tokenIn)\r\n at Microsoft.OData.Core.UriParser.Parsers.SelectExpandBinder.Bind(ExpandToken tokenIn)\r\n at Microsoft.OData.Core.UriParser.Parsers.SelectExpandSemanticBinder.Bind(IEdmStructuredType elementType, IEdmNavigationSource navigationSource, ExpandToken expandToken, SelectToken selectToken, ODataUriParserConfiguration configuration)\r\n at Microsoft.OData.Core.UriParser.ODataQueryOptionParser.ParseSelectAndExpand()\r\n at Microsoft.Crm.Extensibility.OData.CrmODataEntityTypeSerializer.CreateSelectExpandNode(EntityInstanceContext entityInstanceContext)" } } } }
If I delete all the records-> deactivate business process -> add new data and then check the webapi, it is working fine. But when I activate the business process and add new data I am getting the above error P.S: I have not done any coding/customization to business process flow and the entity. But I am still getting this error
What can be done to resolve this?
Looks like a bug in Web API endpoint. Community forums also reference the same issue...
The Web API endpoint still has some limitations and it doesn't fully mimic the OrganizationService behavior so, which will be for the next version (9.x.x) so if you are stuck maybe try applying an update (and then use v8.1 in the url) as, or raise a MS Support case.
If you are still stuck, just try the same using OData / OrganizationService maybe.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With