Now Available in Community - MBAS 2019 Presentation Videos
Catch the most popular sessions on demand and learn how Dynamics 365, Power BI, PowerApps, Microsoft Flow, and Excel are powering major transformations around the globe. | View Gallery
2019 release wave 2 Discover the latest updates to Dynamics 365Release overview guides and videos Release Plan | Early Access Availability
Ace your Dynamics 365 deployment with packaged services delivered by expert consultants. | Explore service offerings
Connect with the ISV success team on the latest roadmap, developer tool for AppSource certification, and ISV community engagements | ISV self-service portal
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Program | Finance and Operations TechTalks | Customer Engagement TechTalks | Talent TechTalks
Recently I spent some time working on Virtual Entities, one of the new features in Dynamics 365 v9.0. To learn more about Virtual Entities, you can read the official documentation here and how to set it up here. In this post, I would like to share my tips and findings working with Virtual Entities and connecting it to a custom oData v4.0 Web API.
During my attempt setting up Virtual Entity, I encountered a very generic error: “Entity could not be retrieved from data source.” for different problems.
The error message is not that descriptive and doesn’t provide further information for me to troubleshoot. I’ve submitted a feedback for this, if you also encounter the similar issue: https://ideas.dynamics.com/ideas/dynamics-crm/ID0003358
The tips in this post hopefully can be helpful to fix the above issue
So, to set the context, in my sample scenario I have a custom oData data source with metadata as below:
Tip #1 – Make sure the path is in the correct case (Upper/Lower)
I was under an assumption: oData seems to be just an URL, so if I throw in the path as all lower case it should be fine…
Well, one of the reason the error being thrown is because oData seems to expect case sensitive path. I entered “movies” instead of “Movies” and in the field mapping I put “rating” instead of “Rating”. So, make sure the mapping and path is the same as the metadata.
Tip #2 – Missing Field Mapping
In my experiment, I created a few extra fields that doesn’t match the metadata definition. Well, this should not create any harm right, just like other custom entity…
Apparently, when there is a missing field in the mapping, the virtual entity is showing the above error.
So, make sure you have the all fields to be mapped correctly and do not create any field that is not in the oData definition. Luckily, you can still omit fields that you don’t like (e.g: when I don’t have “ReleasedYear” field, the VE still works fine).
Tip #3 – Setting Field Requirement(s)
If you noticed my oData definition for Rating field, it is mentioned there: Nullable=”false”. If the oData set up the field to be mandatory, the corresponding field in the VE also need to be set “Business Required”
Tip #4 – Be Careful with the “Numbers”
In my oData definition, I have the Rating field, which is a decimal field. But how about in Dynamics 365 we want it to be stored as a different field type, whole number or float instead? Well, VE doesn’t support that, so we need to ensure the field data type is the same from the data source to the VE’s field.
That’s all for today. Hope this helps!
Business Applications communities