本文介绍了不能够在动态CRM&QUOT进行过滤;机遇与QUOT;交易类型与estimatedclosedate的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用QueryExpression生成的动态CRM过滤器过滤并传送到我的CRM做服务检索的结果。

I am using QueryExpression to generate the filter for the Dynamics crm filters and then passing that to the my CRM made service to retrieve the result.

QueryExpression queryCRM = new QueryExpression
                {
                    EntityName = SourceID,
                    ColumnSet = new ColumnSet(FieldSet),
                    Criteria = new FilterExpression()
                };



然后

and then

queryCRM.Criteria.AddCondition(strFilterColumnName,ConditionOperator.On , strFilterValue);



在这里我无法获取结果任何人可以帮我找出这个问题?
它不为estimatedclosedate这比其他的工作,它工作正常枝条所有其他列

Here i am not able to fetch the result can anybody help me to figure out the issue?It doesn't work for "estimatedclosedate" other than this it works fine withe all other columns.

请注意:=最初,它似乎是一个运营问题,所以我用ConditionOperator.On,所以它解决了我的事件而不是机会的问题。

Note := Initially it seems like an operator issue so i used "ConditionOperator.On" , so it solved my issue for Incident but not for opportunity.

需要从CRM专家那里解决方案。

Need solution from the CRM experts out there.

感谢您。

推荐答案

是strFilterValue字符串?试着通过这个参数作为一个DateTime。这将有助于如果你能在它发布完整的代码段。下面是其中演示了如何使用过滤由预计结束日期机会的一些示例代码。

Is strFilterValue a string? Try and pass this parameter as a DateTime. It would help if you could post this section of code in it's entirety. Here's some sample code which demonstrates the use of filtering an opportunity by estimated close date.

        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);
            }
        }

这篇关于不能够在动态CRM&QUOT进行过滤;机遇与QUOT;交易类型与estimatedclosedate的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 15:34