Solved

Apps 9 - Is there a way i could restrict a date field to only allow a user to a date of today or greater?

  • 24 January 2021
  • 4 replies
  • 99 views

Userlevel 6
Badge +11

We have an issue where some users enter a wanted date in the customer order in the past ( 2020Instead of 2021!)

perhaps I could create an event which fires a message to user? Would like to stop them altogether really so perhaps an event that doesn’t allow a past date?

Any ideas?
 

icon

Best answer by anmise 25 January 2021, 05:11

View original

This topic has been closed for comments

4 replies

Userlevel 7
Badge +21

Hi @BLLBrucemo ,

 

I do not know of a way to configure a field to perform a validation test but your thought on using an event to evaluate the wanted date is spot on.  You'll have to evaluate on insert and updating.  You may also want to validate the order line wanted date as well.

 

Regards,

William Klotz

Userlevel 6
Badge +11

Great thanks, any ideas how I would write the code that would prevent entry of less than TODAY?? I have some ideas but not entirely sure how to write it 

Userlevel 7

Great thanks, any ideas how I would write the code that would prevent entry of less than TODAY?? I have some ideas but not entirely sure how to write it 

Should be as simple as setting up the event on the LU where the date will be set and then checking the entered date against variable #TODAY# or sysdate e.g.

BEGIN
IF '&NEW:DATE' < '#TODAY#'
THEN
Error_SYS.Appl_General('LogicalUnit', 'ERROR: The date must be greater than today');
END IF;
END;

 

 

Userlevel 6
Badge +11

Thanks! Works a treat