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….

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s