locked
FilterExpression on Dates (Eg: SELECT * FROM Cust WHER DATEDIFF(dd,orderdate,getdate()) >20) RRS feed

  • Question

  • Can any one please help me how achieve below using CRM 2011 XRM in .Net

    How to write FilterExpression on Dates

    (Eg: SELECT * FROM Cust WHER DATEDIFF(dd,orderdate,getdate()) >20)

    Please help

    Friday, July 5, 2013 9:15 AM

All replies

  • To get records where the date is older than a certain number of days, your best option is to calculate the date that is 20 days before the current date (using the .Net DateTime class), then use a LessThan CondtionOperator.

    (If you'd records where wanted the date is later than a certain number of days before the current date, you could use a LastXDays ConditionOperator)


    Microsoft CRM MVP - http://mscrmuk.blogspot.com/ http://www.excitation.co.uk

    Friday, July 5, 2013 11:03 AM
    Moderator