rappen / FetchXMLBuilder

FetchXML Builder for XrmToolBox and Microsoft Dynamics 365 / CRM
https://fetchxmlbuilder.com/
GNU General Public License v3.0
133 stars 55 forks source link

Fetch with related virtual records will result in a SQL error #973

Closed MrHosz closed 4 months ago

MrHosz commented 11 months ago

One of my customers is using AAD users as a way to relate internal users to Accounts. If you make a view on Account level with these AAD users as a column - the data is shown as expected.

But if you create a view based on Opportunities and the add the columns from the Account record (as related column) the view in D365 will result in "no data".

When you use fetch XRM to retrieve the records the following error message will occur.

I suppose this is a D365 bug (will also arise a ticket with MS)....


System.ServiceModel.FaultException<Microsoft.Xrm.Sdk.OrganizationServiceFault>:
 Sql error: Generic SQL error. CRM ErrorCode: -2147204784 Sql ErrorCode: -2146232060 Sql Number: 207
FetchXML Builder

Server stack trace: 
- System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
- System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
- System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
- System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]: 
- Microsoft.Xrm.Tooling.Connector.CrmServiceClient.RetrieveMultiple(QueryBase query)
- Rappen.XTB.FetchXmlBuilder.FetchXmlBuilder.RetrieveMultiple(QueryBase query, Boolean allrecords)
- Rappen.XTB.FetchXmlBuilder.FetchXmlBuilder.<>c__DisplayClass125_0.<RetrieveMultiple>b__0(BackgroundWorker worker, DoWorkEventArgs eventargs)
- System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e)
- System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)


rappen commented 9 months ago

As you probably expect - I don't really know why... :/ My response is late, have you any info from MS - or anyone else - on how to fix it, or why we just can't?

Related issue about AAD can be found here : https://github.com/rappen/FetchXMLBuilder/issues?q=is%3Aissue+label%3Avirtuals+

rappen commented 4 months ago

Please reopen if you get more info.