gpt4 book ai didi

dynamics-crm-2011 - 如何在 MS CRM 查询表达式中添加选项集过滤条件?

转载 作者:行者123 更新时间:2023-12-02 21:21:07 26 4
gpt4 key购买 nike

我有一个实体 LeaveType,它具有两个属性:1. 类型,2. 可用天数,其中类型是选项集,可用天数是文本字段。我想获取所有此类 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];
}

最佳答案

根据您的情况,您需要设置选项集的整数值,而不是标签。

假设 Annual 值为 2,则代码为:

GetLeavedetails.Criteria.AddCondition("new_type", ConditionOperator.Equal, 2);

关于dynamics-crm-2011 - 如何在 MS CRM 查询表达式中添加选项集过滤条件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27632999/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com