【发布时间】:2019-10-11 01:48:15
【问题描述】:
我有一个使用管理层次结构来组织员工(用户)的组织。他们想要经理们的看法。此视图应返回由当前用户管理的用户拥有的所有打开的机会,或由当前用户管理的某人管理,或由当前用户管理的某人管理的某人管理。这三个层次就是我们所需要的。
我已经开发了一个 FetchXML 查询,它返回由当前用户管理的用户拥有的所有项目。
<entity name="opportunity">
<attribute name="name" />
<attribute name="estimatedvalue" />
<attribute name="statuscode" />
<attribute name="parentcontactid" />
<attribute name="parentaccountid" />
<attribute name="opportunityid" />
<order attribute="name" descending="false" />
<filter type="and">
<condition attribute="statecode" operator="eq" value="0" />
</filter>
<link-entity name="systemuser" from="systemuserid" to="owninguser" link-type="inner" alias="ad">
<filter type="and">
<condition attribute="parentsystemuserid" operator="eq-userid" />
</filter>
</link-entity>
</entity>
</fetch>
下面是一个也不起作用的替代方法。这将返回由当前用户管理的某人拥有的所有机会,该用户自行管理它们。
<entity name="opportunity">
<attribute name="name" />
<attribute name="estimatedvalue" />
<attribute name="statuscode" />
<attribute name="parentcontactid" />
<attribute name="parentaccountid" />
<attribute name="opportunityid" />
<order attribute="name" descending="false" />
<filter type="and">
<condition attribute="statecode" operator="eq" value="0" />
</filter>
<link-entity name="systemuser" from="systemuserid" to="owninguser" link-type="inner" alias="aa">
<filter type="and">
<condition attribute="parentsystemuserid" operator="eq-userid" />
</filter>
<link-entity name="systemuser" from="systemuserid" to="parentsystemuserid" link-type="inner" alias="ab">
<filter type="and">
<condition attribute="parentsystemuserid" operator="eq-userid" />
</filter>
<link-entity name="systemuser" from="systemuserid" to="parentsystemuserid" link-type="inner" alias="ac">
<filter type="and">
<condition attribute="parentsystemuserid" operator="eq-userid" />
</filter>
</link-entity>
</link-entity>
</link-entity>
</entity>
</fetch>
【问题讨论】:
标签: dynamics-crm dynamics-crm-online fetchxml