pau*_*hit 2 dynamics-crm fetchxml
是否可以编写一个获取根实体和多个子节点的FetchXML查询?我所能做的就是1:1.
詹姆斯伍德是对的.获取XML是递归的,因此通过使用链接实体,您可以获得所需的信息.
例如,以下内容有效:
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true">
<entity name="account">
<attribute name="name" />
<attribute name="primarycontactid" />
<attribute name="telephone1" />
<attribute name="accountid" />
<order attribute="name" descending="false" />
<link-entity name="contact" from="parentcustomerid" to="accountid" alias="aj">
<attribute name="firstname" />
<attribute name="lastname" />
<attribute name="telephone1" />
<link-entity name="businessunit" from="businessunitid" to="owningbusinessunit" alias="ak">
<attribute name="name" />
<attribute name="address1_line1" />
<attribute name="address1_line2" />
<attribute name="address1_line3" />
<filter type="and">
<condition attribute="name" operator="not-null" />
</filter>
</link-entity>
</link-entity>
</entity>
</fetch>
Run Code Online (Sandbox Code Playgroud)
如果您的问题确实是"是否可以编写一个获取单个根实体和多个子节点的FetchXML查询",那么答案很遗憾没有.但是,如果您能够处理根数据的重复(例如,使用SSRS报告的分组功能),那么您需要的是完全可能的
除非我误解了这个问题,否则这很有可能。
因此,例如,您想查找与给定帐户相关的所有联系人。在Crm中,帐户联系人上的“父客户查找”表示。

<fetch mapping="logical" count="100" version="1.0">
<entity name="account">
<attribute name="name" />
<link-entity name="contact" from="parentcustomerid" to="accountid">
<attribute name="fullname" />
</link-entity>
</entity>
</fetch>
Run Code Online (Sandbox Code Playgroud)
这将为您提供一个如下所示的结果集:
<resultset morerecords="0" paging-cookie="<cookie page="1"><accountid last="{E704FAD6-2D4B-E111-9FED-00155D828444}" first="{AD912122-6B3C-E111-9B37-00155D828444}" /></cookie>">
<result>
<name>RGD Mining Inc</name>
<accountid>{E704FAD6-2D4B-E111-9FED-00155D828444}</accountid>
<accountid.fullname>Bill Miner</accountid.fullname>
</result>
<result>
<name>RGD Mining Inc</name>
<accountid>{E704FAD6-2D4B-E111-9FED-00155D828444}</accountid>
<accountid.fullname>Green</accountid.fullname>
</result>
</resultset>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4979 次 |
| 最近记录: |