Dynamics 365(online) V9.0 多选选项集之组织服务查询数据过滤及字段赋值

1.Microsoft.Xrm.Sdk必须是9.0版本或者更高

2.多选项集字段,单个选项数据过滤,示例如下:

queryExpression.Criteria.AddCondition("字段名称", ConditionOperator.ContainValues, 100000003);

3.多选项集字段数据过滤,示例如下:

int[] hikingValue = new int[] { 100000000, 100000001 };
ConditionExpression condition = new ConditionExpression("字段名称", ConditionOperator.ContainValues, hikingValue);

FilterExpression filter = new FilterExpression();            
filter.AddCondition(condition); queryExpression.Criteria.AddFilter(filter);

_serviceProxy.RetrieveMultiple(queryExpression);

4.多选项集字段,获取字段信息,示例如下:

// 显示名称
item.FormattedValues["字段名称"];
// 字段值,sc为 OptionSetValue集合,遍历即可拿到value
OptionSetValueCollection sc = item.GetAttributeValue<OptionSetValueCollection>("字段名称");

5.多选项集字段赋值,示例如下:

OptionSetValueCollection activities = new OptionSetValueCollection();
activities.Add(new OptionSetValue(1)); 
activities.Add(new OptionSetValue(9));
newEntity["字段名称"] = activities;

_serviceProxy.Create(newEntity);
上一篇:timeline时间线


下一篇:论文阅读:On-line simultaneous learning and recognition of everyday activities from virtual reality perfo