我正在使用 crm 2016 并尝试根据链接性过滤获取产品(自定义实体)记录,我需要获取所有具有 Active productstatus 的产品并且链接的电话类别为:fun
not open
产品 - (productstatus = Active) & (linkedphonecallcategory = fun && linkedphonecallstatus != open)
当我运行当前查询时,我得到的结果没有链接实体过滤器。我不明白为什么。
这是我的代码:
FilterExpression filter1 = new FilterExpression(LogicalOperator.And);
filter1.Conditions.Add(new ConditionExpression("phonecallcategory", ConditionOperator.Equal, "fun"));
filter1.Conditions.Add(new ConditionExpression("statecode", ConditionOperator.NotEqual, 0));
LinkEntity phoneCallLink = new LinkEntity("product", "phonecall", "productid", "regardingobjectid", JoinOperator.LeftOuter);
phoneCallLink.LinkCriteria = filter1;
phoneCallLink.EntityAlias = "products";
QueryExpression query = new QueryExpression("product");
query.ColumnSet = new ColumnSet("productname");
query.LinkEntities.Add(phoneCallLink);
query.Criteria.AddCondition(new ConditionExpression("productstatus", ConditionOperator.Equal, 0));
EntityCollection AllProductsWithSpecificCallsNotOpen = new EntityCollection();