【问题标题】:FetchXML query to return all records owned by subordinates of current userFetchXML 查询返回当前用户下属拥有的所有记录
【发布时间】: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


    【解决方案1】:

    您可能对以下所有者运营商感兴趣:

    • eq-useroruserhierarchy
    • eq-useroruserhierarchyandteams
    • eq-useroruserteams
    • eq-userteams

    根据您的描述,您可能想要eq-useroruserhierarchy

    你可以这样使用它:

    <fetch top="50" >
      <entity name="opportunity" >
        <all-attributes/>
        <filter>
          <condition attribute="ownerid" operator="eq-useroruserhierarchy" />
        </filter>
      </entity>
    </fetch>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-06-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多