不能在DynamicsCRM上执行筛选”;机遇";估计关闭日期为的事务处理类型
本文关键字:日期 类型 事务处理 DynamicsCRM 执行 筛选 不能 机遇 quot | 更新日期: 2023-09-27 18:25:58
我使用QueryExpression为Dynamics crm过滤器生成过滤器,然后将其传递给我的crm制造的服务以检索结果。
QueryExpression queryCRM = new QueryExpression
{
EntityName = SourceID,
ColumnSet = new ColumnSet(FieldSet),
Criteria = new FilterExpression()
};
然后
queryCRM.Criteria.AddCondition(strFilterColumnName,ConditionOperator.On , strFilterValue);
在这里我无法获取结果,有人能帮我解决这个问题吗?它不适用于"估计关闭日期",除此之外,它适用于所有其他列。
注:=最初这似乎是一个操作员问题,所以我使用了"ConditionOperator.On",所以它解决了我的Incident问题,但没有解决机会问题。
需要CRM专家的解决方案。
谢谢。
var estimatedCloseDate = DateTime.Parse("2014-10-07");
Guid createdId = Guid.Empty;
Entity matchingEntity = null;
try
{
// Create a test opp
var opp = new Entity("opportunity");
opp["name"] = "Testing Date Filter";
opp["customerid"] = new EntityReference("account", Guid.Parse("b9b0ed35-2a11-4fb6-a56f-5b8c04a3c1d1")); // A valid customer
opp["estimatedclosedate"] = estimatedCloseDate;
createdId = _service.Create(opp);
Console.WriteLine("Created Id: {0}", createdId);
// Create the filter expression
QueryExpression queryCRM = new QueryExpression
{
EntityName = "opportunity",
ColumnSet = new ColumnSet(true)
};
queryCRM.Criteria.AddCondition("estimatedclosedate", ConditionOperator.On, estimatedCloseDate);
// Run the search and check for a match vs the record just created
var results = _service.RetrieveMultiple(queryCRM);
foreach (var result in results.Entities)
{
if (result.Id == createdId)
{
matchingEntity = result;
}
}
// Survey says...
Console.WriteLine(matchingEntity == null
? "Matching entity not found!"
: "Matching entity found!");
}
finally
{
// Delete the created opp
if (createdId != Guid.Empty)
{
_service.Delete("opportunity", createdId);
}
}