Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Suggested answer

How to hide future dates in the date dropdown

(1) ShareShare
ReportReport
Posted on by 522
Hi Guys,
 
In the date dropdown field we have all the dates like past and future dates, but I need to disable the future dates in d365fo. can you please help me to solve this.
  • Suggested answer
    Adis Profile Picture
    Adis 2,428 on at
    How to hide future dates in the date dropdown
    Hey,
     
    I would suggest the following.
     
    Take any form go to Options\Regord info\Database log (see 1) - it doesnt matter if you have the database log active on this table.
    In the created date and time column the to date (see 2) is the current date. Check in visual studio how that was implemented and reuse the code.
    For the "From date" you could just delete the entry, which will imply being 01/01/1900
     
     
     
    Kind regards, Adis
  • Komi Siabi Profile Picture
    Komi Siabi 12,711 Most Valuable Professional on at
    How to hide future dates in the date dropdown
    The date drop-down showing all dates is a system design and you won't be able to change it. However, you should be able to control it individually on tables. 
     
    By the way, like Amine said, you can validate the date. 
  • Raj Borad Profile Picture
    Raj Borad 494 on at
    How to hide future dates in the date dropdown
    Hi,
    What is the reason for such requirement?
  • Suggested answer
    Anton Venter Profile Picture
    Anton Venter 18,788 Super User 2024 Season 2 on at
    How to hide future dates in the date dropdown
    Hello,
     
    You could create a custom lookup form and filter out future dates.
  • Suggested answer
    Mohamed Amine Mahmoudi Profile Picture
    Mohamed Amine Mahmoudi 9,738 Super User 2024 Season 2 on at
    How to hide future dates in the date dropdown
    Hi @Adam123,
     
    it's better to use validation to prevent the user to select a future dates.
     
    for e.g. you can use the validateWrite in your table or datasoure in form :
    public boolean validateWrite()
    {
        boolean ret;
    	ret = super();
    	
    	if(this.yourDateField > SystemDateGet())
    	{
    		ret = checkFailed("your message here");
    	}
    	
    	return ret;
    }
    Best regards,
    Mohamed Amine MAHMOUDI
  • Mohamed Amine Mahmoudi Profile Picture
    Mohamed Amine Mahmoudi 9,738 Super User 2024 Season 2 on at
    How to hide future dates in the date dropdown
    Moved from MS Dynamics AX Form

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

News and Announcements

Announcing Category Subscriptions!

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,370 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans