Limiting the date selection range for a variable of the Date/Time type

Suppose that in a process there is a context variable of the date/time type and you need to limit the date selection range. Below you can find an example of a script, which allows you to change the "date" variable settings in order to enable users to select a date from the 5 days range starting from the current time. To apply these settings, you must specify the script as the script on the form load. To do this, open a task settings window and go to the Context tab. Read more about scripts on the form load in ELMA Help.

//get property settings (of the Date variable) the date/time type 
var settings = (DateTimeSettings)context.GetSettingsFor(c => c.Data);
// specify the minimum value of the selection range 
settings.MinDateValue = DateTime.Now;
// specify the maximum value of the selection range
settings.MaxDateValue = DateTime.Now.AddDays(5);
//save settings
settings.Save();

As a result, on a task form a user will be able to select a value from a limited range: