0

I'm receiving this mysterious error message when using a custom virtual entity data provider:

{
    "error": {
        "code": "0x80040216",
        "message": "An unexpected error occurred.",
        "@Microsoft.PowerApps.CDS.ErrorDetails.ApiExceptionSourceKey": "Plugin/Microsoft.Crm.ObjectModel.InsertLookupLogicalNamePlugin",
        "@Microsoft.PowerApps.CDS.ErrorDetails.ApiStepKey": "ccb4d064-785c-eb11-a812-002248163c60",
        "@Microsoft.PowerApps.CDS.ErrorDetails.ApiDepthKey": "1",
        "@Microsoft.PowerApps.CDS.ErrorDetails.ApiActivityIdKey": "aac514e1-53ec-4ed9-9e47-d2643f0e92b1",
        "@Microsoft.PowerApps.CDS.ErrorDetails.ApiPluginSolutionNameKey": "System",
        "@Microsoft.PowerApps.CDS.ErrorDetails.ApiStepSolutionNameKey": "System",
        "@Microsoft.PowerApps.CDS.ErrorDetails.ApiExceptionCategory": "SystemFailure",
        "@Microsoft.PowerApps.CDS.ErrorDetails.ApiExceptionMesageName": "UnExpected",
        "@Microsoft.PowerApps.CDS.ErrorDetails.ApiExceptionHttpStatusCode": "400",
        "@Microsoft.PowerApps.CDS.HelpLink": "http://go.microsoft.com/fwlink/?LinkID=398563&error=Microsoft.Crm.CrmException%3a80040216&client=platform",
        "@Microsoft.PowerApps.CDS.TraceText": "\r\n[Microsoft.Crm.ObjectModel: Microsoft.Crm.ObjectModel.InsertLookupLogicalNamePlugin]\r\n[ccb4d064-785c-eb11-a812-002248163c60: External plug-in implementation]\r\n\r\n",
        "@Microsoft.PowerApps.CDS.InnerError.Message": "An unexpected error occurred."
    }
}

It seems to occur more often with larger page sizes.

Plugin trace logs indicate the data provider ran successfully/no exception.

Fowl
  • 4,940
  • 2
  • 26
  • 43

1 Answers1

0

After some spelunking I found this error message in the on-prem server:

Query with entity reference to virtual entity can not exceed 250 limit. Please modify your query to reduce the number.

The limit appears to be unique lookup field values across the whole query. So in this example, if the results were as below:

Record Lookup Column to Virtual Entity Lookup Column to Virtual Entity
1 Value A Value B
2 Value C
3 Value A Value C

Would count as 3 towards the limit for that query.

Fowl
  • 4,940
  • 2
  • 26
  • 43