In a CRM 2011 Organization recently upgraded from CRM 4.0, an error is occurring while running some Reports build using CRM Report Wizard. We have been able to consistently reproduce the error.
In the CRM application, the following error is shown:
Reporting Error
The report cannot be displayed. (rsProcessingAborted)
Performing a trace gleaned the following information:
Crm Exception:
Message: Table alias a_SOMEGUID is not unique amongst table and join aliases in this inner query
, ErrorCode: -2147217104
, InnerException: Microsoft.Crm.CrmException: Table alias a_SOMEGUID is not unique amongst table and join aliases in this inner query
at Microsoft.Crm.Query.CrmInnerSelectCommandStrategy.ValidateTableAliasIsUniqueAndAddToTableAliasCollection(String tableAlias)
at Microsoft.Crm.Query.CrmSqlSelectCommandStrategy.AddFromClause(LinkEntityExpression linkEntity)
at Microsoft.Crm.Query.SelectVisitor.Visit(LinkEntityExpression linkEntity)
at Microsoft.Crm.Query.SelectVisitor.Visit(EntityExpression entity)
at Microsoft.Crm.Query.SelectPlan.GetSql()
at Microsoft.Crm.Query.QueryPlan.get_Command()
at Microsoft.Crm.Query.SelectFromSubQueriesPlan.GetSql()
at Microsoft.Crm.Query.QueryPlan.get_Command()
at Microsoft.Crm.BusinessEntities.BusinessProcessObject.RetrieveEntitiesForAggregateQuery(EntityExpression outerQuery, Dictionary`2 subQueries, ExecutionContext context)
at Microsoft.Crm.ObjectModel.AggregationQueryService.RetrieveEntitiesForAggregateQuery(EntityExpression outerQuery, Dictionary`2 subQueries, ExecutionContext context)
The Report includes 2 entities Primary Entity A (Parent) and Related Entity B (Child) with 1:N relationship. The views for Entity A include attributes from Contact entity, thus Entity A's fetch queries contain a Link Entity:
<link-entity alias="a_SOMEGUID" name="contact" from="contactid" to="new_somecontactid" link-type="outer" visible="false">
<attribute name="middlename" />
<attribute name="lastname" />
<attribute name="firstname" />
</link-entity>
When the report is executed without Filter, it will complete successfully. However, adding any Filter to Entity A will result in the error. it looks like both the Filter (parameter) and Report Query contain the same Aliased entity value.
We have verified the SavedQuery definitions, and none of them actually contain a duplicate value.
RU15 includes a fix for:
"Getting error "Table alias 'alias name' is not unique" when opening certain views."
Is this possibly resulting from the same issue?
Has anyone else encountered this? Might there be a way to resolve this? Do you think this is an issue needing to be raised with Microsoft?
Thank you!