1

有没有办法在 Dynamics CRM 2011 的在线版本中使用 FetchXML 按区域(区域在帐户中定义)在未来 30-60-90 天内关闭的所有机会列表。

我尝试通过在测试数据库上编写 SQL 来做到这一点,并且可以使用以下 SQL:

select Territory.TerritoryId ,
 (select count(OpportunityId) from Opportunity where Opportunity.AccountId = Account.AccountId and Account.TerritoryId = Territory.TerritoryId and EstimatedClosureDate < '12/12/2011') as OppIn30Days,
 (select count(OpportunityId) from Opportunity where Opportunity.AccountId = Account.AccountId and Account.TerritoryId = Territory.TerritoryId and EstimatedClosureDate < '12/1/2012') as OppIn60Days,
 (select count(OpportunityId) from Opportunity where Opportunity.AccountId = Account.AccountId and Account.TerritoryId = Territory.TerritoryId and EstimatedClosureDate < '12/2/2012') as OppIn90Days
  from territory left outer join Account on Territory.TerritoryId = Account.TerritoryId --group by Territory.TerritoryId, Account.TerritoryId, Account.AccountId
-- TODO parameterization of query, etc. 

SQL 的结果如下所示。

Columns: TerritoryId|OpportunitiesClosingIn30Days|OpportunitiesClosingIn60Days
Data:   US              5                                   1
        Europe          1                                   4
        Asia            4                                   5

由于不支持外连接,是否可以使用 FetchXML 来执行此操作?

如果我在 Opportunity 中添加一个隐藏的区域字段并编写一些代码以便每次创建机会时都会从相应的帐户复制区域,这会有所帮助吗?

4

1 回答 1

1

不幸的是,这对于 FetchXML 是不可能的。您可能可以使用包含所有相关数据然后对其进行操作以进行显示的报告来模拟它,但是您需要一个 SSRS 专家来为您回答这个问题。

您对非规范化数据的建议可能是正确的:如果您添加Territory到您的机会,然后您可以使用 MSCRM 仪表板显示按地区按月关闭的机会。

于 2012-05-08T04:16:34.690 回答