Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV forum
Suggested answer

Date is not valid

Posted on by 5

OnAfterGetRecord()
IF "Solved Date" = 0D THEN
Aging := WORKDATE - "Reqeusted Date"
ELSE
Aging := "Solved Date" - "Reqeusted Date";

Aging is integer data type.

  • Suggested answer
    RE: Date is not valid

    Hi Narayan,

    You are right that Date - AnotherDate should return an Integer. But only if the date is defined. If one of the dates is undefined, then you get the error. So you need to test more for 0D, for example

    IF "Requested Date" <> 0D THEN

      Aging := WORKDATE - "Requested Date"

    ELSE

      Aging := 0 // (or any ohter default value)

    So in this code you test correctly on "Solved date", but you also need to test that "Requested Date" <> 0D before you can use it in a calculateion,

    hope that helps

  • Suggested answer
    Andy Sather Profile Picture
    Andy Sather on at
    RE: Date is not valid

    Would you be able to describe the issue you are running into?

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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

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

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,558 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,647 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans