Skip to main content

Notifications

Announcements

No record found.

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 220

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

  • Suggested answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: filter the email was sent within the service date?

    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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,494 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,307 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans