Skip to main content

Virtual Entities 0x80040203 Invalid Argument Error

I stumbled upon this issue after creating a custom virtual entity data provider.Ivan Ficko has a great tutorial on this here.

The subgrid displayed records perfectly fine in the old web client, but in UCI i received the below error message “0x80040203 Invalid Argument”. After some search and only finding a single post regarding this with no answers, i decided to take matters into my own hands! Digging through my  browsers console i managed to find additional information regarding this error. Inspecting the  exception, i found the message “entity name is invalid”.

Surprisingly a simple solution, jumping into your plugin/ custom provider code.  As well as assigning an entity name to all your individual rows/entities you also need to add the name to your returned Entity Collection.

Quick example of a virtual entities collection below, all you need to do is make sure that the name is set “EntityCollection.EntityName = “name of your entity”. Simples!

//Add individual rows/entities to your collection
EntityCollection ec = new EntityCollection();

ec.EntityName = "new_myEntity"; // Add this line 
foreach (var item in listOfRecords)
{
Entity entity = new Entity("new_myEntity", Guid.Parse(item.myID));

//Add stuff to entity

///add entity to entity collection
ec.Entities.Add(entity);

}
//return collection
context.OutputParameters["BusinessEntityCollection"] = ec;

Charles Osei

Dynamics 365 Consultant @ RSM MCSE Business Applications Computer Science – University of Lincoln 2017 Nottingham D365/CRM user group Chapter Leader TDG – Community leader Twitter @charliedevxyz LinedIn https://www.linkedin.com/in/charlesosei/

2 thoughts to “Virtual Entities 0x80040203 Invalid Argument Error”

Leave a Reply

%d bloggers like this: