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 CRM (Archived)

Passing date to oData query

(0) ShareShare
ReportReport
Posted on by 1,680

Hello,

Here is my code to retreive data using oData Query

var startTime = Xrm.Page.getAttribute("scheduledstart").getValue();
var endTime = Xrm.Page.getAttribute("scheduledend").getValue();


odataQuery = "ServiceAppointmentSet?$select=ScheduledEnd,ScheduledStart&$filter=ActivityId ne guid'" + currServiceAppointmentID + "' and StatusCode/Value eq 4 and ScheduledStart lt datetime'" + endTime + "' and ScheduledEnd gt datetime'" + startTime + "'";

Which fails because of Data-time conversion, Can anyone let me know how to convert the datatime to Edm.DateTime which is accepted by oData.

Thanks

Drew 

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Abed Haniyah Profile Picture
    4,287 on at

    Hi,

    Please refer to Aileen's post :missdynamicscrm.blogspot.com/.../crm-2011-crm-2013-odata-datetime.html

    Hope this helps,

    Abed.

  • Verified answer
    Rajkumar Rajaraman Profile Picture
    on at

    Hi Drew,

    Walkthrough the following article. It explains how to convert the datatime to Edm.DateTime in deeply.

    missdynamicscrm.blogspot.in/.../crm-2011-crm-2013-odata-error-when.html

    Hope this helps.

    Regards,

    R.Rajkumar

  • Verified answer
    ashishkhanna Profile Picture
    180 on at

    I agree with the approach others explained here but I have found this tool really helpful to generate odata queries without getting too much into the code

    dynamicsxrmtools.codeplex.com

  • Verified answer
    Mahendar Pal Profile Picture
    45,095 on at

    You can also check this: blogs.catapultsystems.com/.../crm-2013-handling-odata-date-field-value

    Thanks

  • Drew Inc. Profile Picture
    1,680 on at

    Thanks that helped a lot!!

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 CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans