Dynamics CRM Date filter is not working on Opportunity transaction type on Estimated Close Date. RRS feed

  • Question

  • I am using the Query Expression to filter the records i have on the client side.I am doing as follows,

    QueryExpression queryCRM = new QueryExpression
      EntityName = SourceID,
      ColumnSet = new ColumnSet(FieldSet),
      Criteria = new FilterExpression()
    queryCRM.Criteria.AddCondition(_strFilterColumnName, ConditionOperator.On, strFilterValue);

    where variables like Filter column is the name of the field and operator i used is "On" because i am filtering on Date column.

    Interestingly this code works if i point to some other CRM and doesn't works if i point it to my test machine's CRM.

    Can any one out there help me resolve this issue.

    Thank You!


    Thursday, October 9, 2014 8:09 AM

All replies

  • Hi,

    I haven't tried this, but i'm assuming the "strFilterValue" should be a "datetime" field and it shall work fine. Are you passing it as a datetime or a string?


    Thursday, October 9, 2014 9:25 AM
  • Hi,

    I suggest you check other CRM environment version and your test environment version are same.


    Thursday, October 9, 2014 9:32 AM
  • it is string right now. but it works if i point to one CRM it doesn't work and for other it works perfect.

    how come ? is there any other thing to make sure.??

    Thursday, October 9, 2014 9:33 AM
  • So, isn't that any such code that works for all environment.?
    Thursday, October 9, 2014 9:41 AM
  • how come ? is there any other thing to make sure.??

    Use datetime instead of string. Point.

    Dynamics CRM MVP/ Technical Evangelist at SlickData LLC
    My blog

    Thursday, October 9, 2014 9:49 AM
  • I have tried and put 

    var strFilterValue = DateTime.Parse(FilterValueList[i].ToString());

    but it still didn't work out for me. :(

    Still my question come to one thing that how it works with one CRM and do not work with other?

    Thursday, October 9, 2014 10:05 AM
  • and one more thing that the CRM that it works with is expecting mm-dd-yyyy format.and then it works.
    Thursday, October 9, 2014 10:08 AM