小编gee*_*ent的帖子

如何在MS CRM查询表达式中添加选项集筛选条件?

我有一个实体LeaveType有两个属性,1.类型,2.可用天数,其中Type是一个选项集,Available days是一个文本字段.我想获取所有这些LeaveType记录,其中Type ='Annual'在选项集中选择.我无法找到如何为选项设置值添加过滤器查询表达式.以下是我的进度方法:

public Entity Getleavetype(Guid LeaveDetailsId, IOrganizationService _orgService, CodeActivityContext Acontext)
        {
            QueryExpression GetLeavedetails = new QueryExpression();
            GetLeavedetails.EntityName = "sgfdhr_leavetype";
            GetLeavedetails.ColumnSet = new ColumnSet("new_type");
            GetLeavedetails.ColumnSet = new ColumnSet("new_availabledays");
            GetLeavedetails.Criteria.AddCondition("new_type", ConditionOperator.Equal,   "Annual" ); //Is this correct????
            GetLeavedetails.Criteria.AddCondition("new_employeeleavecalculation", ConditionOperator.Equal, LeaveDetailsId); //ignore this

            //((OptionSetValue)LeaveDetailsId["new_leavetype"]).Value

            EntityCollection LeaveDetails = _orgService.RetrieveMultiple(GetLeavedetails);
            return LeaveDetails[0];
        }
Run Code Online (Sandbox Code Playgroud)

crm query-expressions dynamics-crm-2011

1
推荐指数
1
解决办法
3375
查看次数

标签 统计

crm ×1

dynamics-crm-2011 ×1

query-expressions ×1