Use Cases
- Restrict date selection to a specific number of days from the current date (e.g., if today is December 20, users can only select from December 30 onwards). This is helpful for creating built-in SLAs for when a task can be completed.
- Disallowing Selection of Past Dates in the Date Picker Field. This prevents any issues with users adding inaccurate dates.
- Automatic Calculation of Deadline Based on Assessment Creation Date. This approach is ideal for time-sensitive assessments, enabling you to set a deadline a specific number of days after creation. For instance, if the deadline for a Contract Review is April 30, the calculated date can be used to display the expected completion deadline to users or to trigger scheduled reminders.
Step-by-Step Instructions
Restrict date selection to a specific number of days from the current date
Capturing the Current Date Using a SET_VAR Block
-
Add a SET_VAR block before the FORM block where users will select a date from the DATE Picker field.
- Click on the SET_VAR block to edit its properties and select "Create new variable" from the Select Function dropdown.
- Under Create new variable, set the Variable type to Datetime and assign a variable name (e.g.,
CurrentDate
). - In the Select date dropdown, choose "Current Date" to capture the current system date.
Adding Days to the Current Date Using the DATE_CALC Block
- Add a DATE_CALC block and create a route from the SET_VAR block to connect them to each other.
- Click on the SET_VAR block and select "Add time period to date" from the Select Function dropdown.
- In the Add time period of field, enter the required number of days, and select "Days" in the Select unit of time dropdown.
- Note: The current day is included in the count. To select a date after the 10th day from today, set the value to 11 days.
- In the Select date variable field, choose the variable that holds the current date (e.g.,
CurrentDate
). - Select the preferred date format from the Format Date as dropdown.
Using the DATE_CALC Result to Set a Minimum Date for the Date Picker Field
- Select the FORM block where users will select a date, then click "Open Form Builder."
- Add a DATE PICKER field to the form.
- In the Property Editor, navigate to the Field Validation section.
- Select the "By date variable" radio button.
- Under Optional minimum date, enter the variable name assigned in the DATE_CALC block.
Output Preview from Test Run
Below is the result when the user attempts to select a date while the current date is March 4, 2025.
As shown, the user can only select dates from March 15, 2025, onwards.
Disallowing Selection of Past Dates in the Date Picker Field
Capturing the Current Date Using a SET_VAR Block
- Add a SET_VAR block before the FORM block where users will select a date from the Date Picker field.
- Click on the SET_VAR block to edit its properties and select "Create new variable" from the Select Function dropdown.
- Under Create new variable, set the Variable type to Datetime and assign a variable name (e.g.,
CurrentDate
). - In the Select date dropdown, choose "Current Date" to capture the system's current date.
Using the SET_VAR Value to Impose a Minimum Date
- Select the FORM block where users will select a date.
- Add a route from the SET_VAR block to the FORM block.
- Click "Open Form Builder."
- Add a DATE PICKER field to the form.
- In the Property Editor, navigate to the Field Validation section.
- Select the "By date variable" radio button.
- Under Optional minimum date, enter the variable name assigned in the SET_VAR block (
CurrentDate
).
Output Preview from Test Run
Below is the result when the user attempts to select a date while the current date is March 4, 2025.
As shown, the user can only select dates from the current date onwards.
Automatic Calculation of Deadline Based on Assessment Creation Date
Capturing the Assessment Creation Date Using the SET_VAR Block
- Add a SET_VAR block before the user intake FORM block.
- Click on the SET_VAR block to edit its properties.
- In the Select Function dropdown, choose "Create new variable".
- Under Create new variable:
- Set the Variable type to Datetime.
- Assign a variable name (e.g.,
CurrentDate
).
- In the Select date dropdown, choose "Current Date" to capture the system’s current date.
Using the DATE_CALC Block to Set the Deadline Date
- Add a DATE_CALC block and create a route from the SET_VAR block to it.
- Click on the DATE_CALC block to edit its properties and select "Add time period to date" from the Select Function dropdown.
- In the Add time period of field, enter the required number of days, and select "Days" in the Select unit of time dropdown. For example, if the user needs to complete the assessment within 30 days, input
30
as the time period and days as the unit of time. - In the Select date variable field, choose the variable that holds the current date (e.g.,
CurrentDate
). - Select the preferred date format from the Format Date as dropdown.
Output Preview from Test Run
When previewing the AssessmentDeadline variable value in the FORM, we can see that the assigned deadline is April 3, 2025, for an assessment created on March 4, 2025 (30 days after the creation date).