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

Compare two dates from table Dynamics

(0) ShareShare
ReportReport
Posted on by

I'm having problem with my little task. I have a table with information about two users who are working during this time.image If this time intersect I need get a MESSAGE/ERROR about it. Can you explain how to do this? Thanks!!

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Zaid Tariq Profile Picture
    2,274 on at

    Hi,

    If you want to use show the message when user enters the data in the field Finish Date then go to the OnValidate trigger of the Finish Date and write the following code:

    Test.SETCURRENTKEY("Date Start","Date Finish");
    Test.SETFILTER(Name,Name);
    Test.SETFILTER(ID,'<>%1',ID);

    IF Test.FINDFIRST THEN
    BEGIN

    IF (Test."Date Start" >= "Date Start") AND (Test."Date Start" <= "Date Finish") THEN
    ERROR('User %1 is already busy during these days',Test.Name)
    ELSE IF (Test."Date Finish" >= "Date Start") AND (Test."Date Finish" <= "Date Finish") THEN
    ERROR('User %1 is already busy during these days ',Test.Name)
    ELSE IF (Test."Date Start" <= "Date Start") AND (Test."Date Finish" >= "Date Finish") THEN
    ERROR('User %1 is already busy during these days ',Test.Name);

    END;

    Create a Test Record variable of type Test table

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 March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans