Virtual Entities 0x80040203 Invalid Argument Error

0

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();
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);

}
ec.EntityName = "new_myEntity"; // Add this line 
//return collection
context.OutputParameters["BusinessEntityCollection"] = ec;
Choose your Reaction!
Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.