1

I have this custom api called "pits_PostProjectLineEntries" which takes in a EntityCollection called Transactions. I am using the option to have the entities in that EntityCollection to be expando since I really not need to create a table to hold this entities. I am able to call the custom api via PostMan with some raw json, and it works perfectly. My issue is when I use C# Plugins, I am getting errors messages about the entities logical name within Transactions collection. Is there a way to tell the Xrm SDK that these entities are not tied to a physical table but are just expando.

Here is the code that calls the Custom API for ref.

_transactions = new List<Entity>();
Entity Transaction = new Entity("");
Transaction["date"] = userReport.GetAttributeValue<DateTime>("pits_date");
Transaction["project"] = userReport.GetAttributeValue<EntityReference>("pits_project");
Transaction["resource"] = userReport.GetAttributeValue<EntityReference>("pits_user");
Transaction["task"] = userReport.GetAttributeValue<EntityReference>("pits_task");
Transaction["worktype"] = response["WorkType"];
Transaction["shifttype"] = response["ShiftType"];
Transaction["quantity"] = RG;
Transaction["chargeable"] = true;
Transaction["tx_type"] = 361200000;
_transactions.Add(Transaction);
EntityCollection Transactions = new EntityCollection(_transactions); 
OrganizationRequest request = new OrganizationRequest("pits_PostProjectLineEntries");
request.Parameters.Add("Transactions", Transactions);
var response = _context.OrganizationService.Execute(request);

The error message I get is:

An unexpected error occurred: The entity with a name = '' with namemapping = 'Logical' was not found in the MetadataCache.

I am trying to call this custom api and pass it an entity that is tied to a DV Table from the C# sdk.
Sorry if the formatting is bad, I have been using stack overflow for a long time, but first time posting

Henk van Boeijen
  • 7,357
  • 6
  • 32
  • 42

1 Answers1

1

This is a known bug with Expando entities in the currently shipping SDK assemblies, The Dataverse ServiceClient version (.net / cross platform) of the SDK should be working correctly at this time. You can get that here: https://www.nuget.org/packages/Microsoft.PowerPlatform.Dataverse.Client/

The libraries from Microsoft.CrmSdk.CoreAssemblies will have the fix on next update (at the time of this writing)

MattB
  • 171
  • 4
  • Yeah so that would not help since Dataverse ServiceClient is not for Plugins, but for outside applications to make WebApi calls to the Dataverse. I did end up have to make my own WebApi calls from within my plugin(with much headache do to security). I like the idea that they are spilting Power Platform CDS stuff away from D365. – Brandon Joye Mar 27 '22 at 01:09
  • The plug-in infrastructure should all ready have this fix, depending on geo. – MattB Mar 27 '22 at 01:15