Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

date filtering

Posted on by 12,070 Super User 2024 Season 1

Hi all,

I have to compare actual date with today for example.

today = 25/11/2016

actual date = 18/11/2016

the difference between two date is 7 than I have to run report otherwise not. How can I do that?

Thank you

*This post is locked for comments

  • Verified answer
    Abdul Wahab Profile Picture
    Abdul Wahab 12,070 Super User 2024 Season 1 on at
    RE: date filtering

    Hi all

    I fulfill my requirement with that line Opportunity.EstimatedCloseDate BETWEEN TODAY() AND DATE_ADD(NOW(), INTERVAL 7 DAY)

    Thank you

  • Verified answer
    PS Profile Picture
    PS 23,577 on at
  • Abdul Wahab Profile Picture
    Abdul Wahab 12,070 Super User 2024 Season 1 on at
    RE: date filtering

    Hi Mark Christie

    I am writing code on report builder. Please suggest me on that site.

    Thank you

  • Suggested answer
    TheMarkChristie Profile Picture
    TheMarkChristie 10,328 on at
    RE: date filtering

    Hi,

    You can use something similar to

    function DateDiff() {

    var startDate = Xrm.Page.getAttribute('actualstart').getValue();

    var endDate = Xrm.Page.getAttribute('actualend').getValue();

    // to cancel the error when undefined

    if (start == undefined || start == null || end == undefined || end == null) {

    return;

    }

    // Get 1 day

    var day = 1000 * 60 * 60 * 24;

    // Get time in days

    var time = ((end - start) / day) + 1;

    // Can't be less than 0.

    if (time < 0)

    time = 0;

    // Set the duration

    Xrm.Page.getAttribute('actualdurationminutes').setValue(time);

    }

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans