Personalized Community is here!
Quickly customize your community to find the content you seek.
Check out the latest Sales updates!Learn about the key capabilities and features of Dynamics 365 Sales and experience some of the new features.
Download overview guide | Watch Sales video
2020 Release Wave 2Discover the latest updates and new features to Dynamics 365 planned through March 2021.
Release overview guides and videos Release Plan | Preview 2020 Release Wave 2 TimelineWatch the 2020 Release Wave 1 virtual launch event
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 TechTalks | Customer Engagement TechTalks | Upcoming TechTalks
I have created the retrieve multiple and retrieve plugins for a virtual entity that makes an HTTP call to an Azure function that queries a SQL database in Azure. The retrieve multiple works great and returns all the records or the filtered records. In the view, I added all fields and can see all the data. I then click on a record to open the form and view the data there and I get a "null reference error". The message does not tell me the field. When dealing with a plugin, I am setting the fields via the schema name and not the external name, so I know external name does not matter. I also made sure that all fields, with exception of the record ID is set to optional. I also made sure that only fields that have data are returned from the plugin (i.e. I wrapped each field in an if statement to check for nulls and not pass the field if it is null). I also added in traces to output to the trace to see the JSON that is returned from my HTTP request and also loop through all the fields in the trace to output what is being passed into each field in the entity. I can see the correct single record being returned. I am setting the entity id to the GUID from the external database. I am really at a lost on what could be null. Anyone think of anything that I might have missed or can you not view virtual entity in forms. I will also not that lookups linked to the virtual entity work as well.
Use GUIDs as primary keys in the external data source. Might be possible that primary key is null?
Secondly need to check if datatype of all the data is not other than type which is not supported in Dynamics CRM e.g: Single Line of Text, Multiple Lines of Text, Whole Number, Date Time etc.
It would be helpful if you share snapshot of view (having data) and form (having null reference error).
Thank you for the reply. Here is my response:
1) I setup the database and the primary key for each row is a GUID and set to not null. So all new rows in the database get a GUID. That GUID is also passed as the primary key for the record in CRM.
2) For data types, that is with the OData v4 endpoint approach. I am using the Retrieve Multiple and Retrieve plugins, so data type and external names don't matter in the data entity in CRM. That is because the field mapping / conversions are done in the plugin code. The only external names that matter is on the source entity in crm for the guid and the name field. When using plugins you have 2 entities in CRM. The one you send the data too and the one that acts as the source.
3) Here is the link to the blog I followed that allowed me to get what I have working: https://jlattimer.blogspot.com/2017/12/creating-custom-virtual-entity-data.html
4) I have traces in my plugins that shows me the data as it is being returned. I have it output me the JSON and then each entity attribute with value. As I stated in my original post. There are no null values and the fields in CRM are all set to optional, with exception of the primary key, which is getting a value.
5) I can not share a screen shot of the data or code due to proprietary information. All I can share is what I have and that is what I have done. It doesn't make sense that the "view" works perfectly fine, even in advanced find it works. But, when I click on a record it causes a null reference error. The only difference between the two plugins is the retrieve multiple returns an entity collection and the retrieve only returns an entity.
Business Applications communities