AXForum  
Вернуться   AXForum > Microsoft Dynamics CRM > Dynamics CRM: Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 02.12.2013, 21:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,626 / 848 (80) +++++++
Регистрация: 28.10.2006
crminthefield: FetchXML Exception Reporting in Microsoft Dynamics CRM 2013
Источник: http://blogs.msdn.com/b/crminthefiel...-crm-2013.aspx
==============

Want to know what accounts in Dynamics CRM have no related opportunities? How about which contacts haven’t had any activities in the last few months? Exception reporting using the FetchXML data processing extension is one feature that in previous versions of CRM, has not been possible. With the introduction of Microsoft Dynamics CRM 2013, the capabilities of a left outer join is possible, therefore customers can now perform custom exception reporting with the FetchXML DPE out of Microsoft Dynamics CRM.

In CRM 2011 Fetch cannot express queries of the form:
· Find all Accounts that have no Opportunities

· Find all Accounts that have no Contacts

· Display a list of contacts who did NOT have any campaign activity within the last X months

The following syntax in CRM 2011 doesn’t work exactly as expected for Fetch XML.

1: 2: 3: 4: 5: 6: 7: 8: 9: 10:
This FetchXML converts to the following SQL:
SELECT account.Name
FROM Account as Account
LEFT OUTER JOIN Opportunity
ON (account.Accountid = Opportunity.Customerid and (Opportunity.Customerid is null))

Since the filter condition is appended to the ON, this query does not work as expected.

In CRM 2013 this scenarios can be addressed as follows:

An alias must be defined for a link-entity in order for it to be used in the filter. In the filter element, the value of the attribute (customerid) is the field of the form entityname (ab) which must have been already defined as an entity name or alias or a link-entity name or alias.

1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12:
This Fetch XML would result in SQL equivalent to:
SELECT account.Name
FROM Account as account
LEFT OUTER JOIN Opportunity ab
ON (account.accountid = ab.customerid)
WHERE ab.customerid is null

Note that the filter has moved from the ON clause to the WHERE clause.

Another example, here including more than one filter, returning all accounts that either don’t have any related activities or they don’t have any open related activities:

1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17:
Here is a summary of the considerations:
· Filter on the LEFT OUTER JOIN should apply to the WHERE clause when converted to SQL.

· Entity alias can be used in the filter clause.

· In the link-entity node of a Fetch XML query, an alias can be specified. This alias should be supported in the filter node when performing a LEFT OUTER JOIN.

• FetchXML involving a Join are not editable in the Advanced Find editor or customization settings from the application.

• However, this can be executed via SDK or imported as part of a solution.

If you are interested, our PFE team is ready to help you. We have many services we offer such as reporting workshops, developer training, admin workshops, and code reviews. If you would like to have another Microsoft PFE or I visit your company and assist with the ideas presented on our blog, contact your Microsoft Premier Technical Account Manager (TAM) for booking information. For more information about becoming a Microsoft Premier Customer email PremSale@microsoft.com.

Thanks!

Sarah Champ

Microsoft Premier Field Engineer





Источник: http://blogs.msdn.com/b/crminthefiel...-crm-2013.aspx
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
CRM DE LA CREME! CRM 4.0 Disaster Recovery Blog bot Dynamics CRM: Blogs 2 26.02.2016 08:23
crminthefield: Podcast and Overview: Microsoft Dynamics CRM 2011 Update Rollup 14 Blog bot Dynamics CRM: Blogs 0 12.07.2013 07:13
crminthefield: Microsoft Dynamics CRM 2011 White Papers & Technical Documentation Blog bot Dynamics CRM: Blogs 0 29.12.2011 01:12
crminthefield: Overview: Microsoft Dynamics CRM 4.0 Update Rollup 19 Blog bot Dynamics CRM: Blogs 0 26.08.2011 01:13
Microsoft Dynamics CRM Team Blog: Top 14 Microsoft Dynamics CRM Sites and Downloads Blog bot Dynamics CRM: Blogs 0 14.07.2008 13:05

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 08:46.