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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

filter the email was sent within the service date?

(0) ShareShare
ReportReport
Posted on by 224

i tried to use this to filter the email that was sent within the date from validfrom to validto  and this is not working. 

var filter = "?$filter=field_InitialEmailSentOn'" + sentOn + "' and field_ValidFrom ge datetime'" + validfrom + "' and field_ValidTo le datetime'" + validto + "'";

And the sentOn that was an array and the data like this 

3173.convert.PNG

how to convert the this date time to string? because the validfrom and validto is already converted to string using this

var date = new Date(parseInt(validfrom.replace("/Date(", "").replace(")/", ""), 10));
date = date.toISOString();
return date;

var date = new Date(parseInt(validto.replace("/Date(", "").replace(")/", ""), 10));
date = date.toISOString();
return date;

how to convert the value of sentOn to date and time string? that was from an array?

thanks for the help

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    RaviKashyap Profile Picture
    55,410 Moderator on at

    Hi Kael,

    The date object is an array i.e. it can contains more than 1 value. To get the value of the 1st occurence, you can use something  like this-

    var date = new Date(parseInt(sentto[0].replace("/Date(", "").replace(")/", ""), 10));

    date = date.toISOString();

    return date;

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
ScottDurow Profile Picture

ScottDurow 2

#2
GJones Profile Picture

GJones 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans