skip to Main Content

Creating a plugin for virtual entity, while trying to parse an EntityCollection to PluginExecutionContext in Microsoft.Xrm.Sdk it fails with message

Error

"message":"OutputParameters must contain a property called 'BusinessEntityCollection' of type Microsoft.Xrm.Sdk.EntityCollection for SDK message RetrieveMultiple",

Code is something like

            string data = await GetData(localcontext);
            
            var desrlzdData = JsonConvert.DeserializeObject<CustomEntity[]>(data);
            EntityCollection collection = new EntityCollection();
            foreach (var d in desrlzdData)
            {
                collection.Entities.Add(mapper(d));
            }

            // Add result to output parameters
            localcontext.PluginExecutionContext.OutputParameters["BusinessEntityCollection"] = collection;

2

Answers


  1. Chosen as BEST ANSWER

    The problem was with async code, I was not doing await at one of the place. So The BusinessEntityCollection was not getting populated but the error message is bit misleading.


  2. Modify the last time in this:

    localcontext.PluginExecutionContext.OutputParameters["EntityCollection"] = collection;
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search