如何使用 Web API 从 Activitypartys 表中过滤其中派对查找字段与系统用户相关的记录

问题描述 投票:0回答:1

我正在从 Dynamics 365 CRM 的约会中的“所需参加者”查找字段查询约会参与者。 我创建了一个查询,该查询返回“activityparties”表中的记录,其中“participationtypemask”等于 5(必需的参加者)。我尝试应用第二个过滤器以仅返回参与方为用户的记录,但该过滤器被忽略,并且我获得了所有参与方(帐户、联系人、案例等)的记录。

这是我的询问:

OData.Feed("https://ar.api.crm4.dynamics.com/api/data/v9.2/" &
        "activityparties?" & 
        "$select=_activityid_value, participationtypemask, _partyid_value,&" &
        "$expand=
            partyid_systemuser($select=_amo_teamcompanynumber_value)&"
        &
        "$filter= participationtypemask eq 5 and partyid_systemuser ne null", 
        null, [Implementation="2.0", IncludeAnnotations="*"]),

滤镜

partyid_systemuser ne null
没有效果。

如何更改此过滤器以仅获取该方为系统用户的记录?

odata microsoft-dynamics crm webapi m
1个回答
0
投票

我建议使用 FetchXml 来获取数据。这是我想到的:

<fetch>
  <entity name="systemuser">
    <attribute name="systemuserid" />
    <link-entity name="activityparty" from="partyid" to="systemuserid" link-type="inner">
      <filter>
        <condition attribute="participationtypemask" operator="eq" value="5" />
      </filter>
    </link-entity>
  </entity>
</fetch>
© www.soinside.com 2019 - 2024. All rights reserved.