web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics SL (Archived)

How to Filter Date column in web api query?

(0) ShareShare
ReportReport
Posted on by 2

I need syntax for retrieving issuestarttime is >= 2 years from today.  The pseudo code equivalent is issuestarttime >= DAY(TODAY()) - 760

How to do in web api query (pulling from Dynamics CRM)?

As first step I am trying to merely retrieve data greator than/equal to a given date, but am getting error:

I HAVE TRIED
https://OK.api.crm.dynamics.com/api/data/v8.1/mc_alerts?$select=_mc_symptomtypealertid_value,mc_resolutiontime,mc_alertnumber,statuscode,statecode,mc_fixphases,mc_alertid,%20mc_symptomdurationhours,%20mc_name,%20mc_symptomdurationtotalminutes,%20mc_customersaffected,%20mc_eventdurationdays,%20mc_resolutiontime,%20mc_eventdurationtotalminutes,%20mc_eventdurationminutes,%20mc_businessimpact,%20mc_alertnumber,%20mc_eventdurationhours,%20mc_symptomdurationdays,%20new_totalcustomersimpacted,%20mc_symptomdurationminutes,%20mc_issuestarttime,%20mc_severityid,%20mc_subtypeid,%20mc_symptomtypealertid,mc_fixphases,_mc_severityid_value,mc_reportedstarttime,_mc_subtypeid_value&$filter=statecode%20eq%200%20and%20statuscode%20eq%20100000000%20or%20statuscode%20eq%20100000000%20or%20statuscode%20eq%201%20and%20mc_issuestarttime ge ('2015-06-01 00:00:00')

Error

DataSource.Error: Microsoft.Mashup.Engine1.Library.Resources.HttpResource: Request failed:
OData Version: 3 and 4, Error: The remote server returned an error: (400) Bad Request. (A binary operator with incompatible types was detected. Found operand types 'Edm.DateTimeOffset' and 'Edm.String' for operator kind 'GreaterThanOrEqual'.)
OData Version: 4, Error: The remote server returned an error: (400) Bad Request. (A binary operator with incompatible types was detected. Found operand types 'Edm.DateTimeOffset' and 'Edm.String' for operator kind 'GreaterThanOrEqual'.)
Details:
    DataSourceKind=OData
    DataSourcePath=https://missioncontrol.api.crm.dynamics.com/api/data/v8.1/mc_alerts

Thanks in advance.

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

    Same problem, did you ever figure this out? It works great when the field is just a DateTime field. 

  • Community Member Profile Picture
    on at

    use date without time and pass in below format and recommend to always use UTC.

    Below worked for me:

    accounts?$filter=modifiedon ge 2018-04-28

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics SL (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans