How to use special date operators (last-month for ex) in OData and MS Flow

Today we got a requirement to fetch all the records that are created in the last month by using MS Flow. We can do this by using “Dynamics 365 List records” action and we have to provide OData filter query for this action. I tried to use the same “last-month” operator that we use in the fetch xml. But this will not work for OData query. We need to use “LastMonth” function for this as defined in this link. The below are the examples to use these date functions.

In OData Query

?$filter=Microsoft.Dynamics.CRM.LastMonth(PropertyName=@p1)&@p1=’createdon’

In MS Flow

Hope it is useful….

4 thoughts on “How to use special date operators (last-month for ex) in OData and MS Flow

Leave a reply to Nishant Rana Cancel reply