Appearance
Task Due Date
Within a workflow definition, a task can be given a due date. The due date can be set using a liquid expression enclosed within {{ }} and will be evaluated upon the task's instantiation. More details about liquid available here. The due date can be set by selecting options via a date builder, or as a liquid expression using the expression view.
Date Builder
The date builder consists of input fields to capture the base date and then additional options to increment or round up to a desired date/time. It provides the following options
- The first row of fields support specifying the base date. This will be what the rest of the expression is based on. It can be set to "now" which would be the date & time when the task gets instantiated. The other option is to specify a fixed date/time.
- The second row of fields lets you add time to the base date
- The third row of field provides options to round the date up to the next month, weekday, hour or a day of the week.
To note:
- When the task gets instantiated, the due date is derived by first applying any increments to the base date and secondly by applying the rounding.
- If multiple rounding options are selected, they are applied in the order in which they were selected.
Expression View
The expression view lets you directly edit the underlying liquid expression, to customize or supply a more advanced configuration than can be done using the UI view.
To note:
- The due date expression takes the form of a liquid expression enclosed within
- If a fixed date/time is required, it can be specified in the format "YYYY-MM-DDTHH:mm:ss" or "YYYY-MM-DD HH:mm:ss" (without the time separator)
- When the liquid expression gets modified, the system tries to refresh the UI view according to the changes. If unsuccessful, it disables the UI view.
- The custom liquid filter to increment is
plus_timeand comes with named arguments and their corresponding values. One filter can be used to specify multiple options. - The custom liquid filter to applying rounding is
round_to_nextand can only one value at a time. Hence separate filters are to be used to specify multiple options in the desired order.
Some example expressions are as follows:
liquid
{{ 'now' | round_to_next: 'weekday' }}
{{ 'today' | round_to_next: 'SUNDAY' }}
{{ '2020-10-05T12:34:56.0000000Z' | plus_time: months: 1, days: 1, hours: 2 }}
{{ '2020-10-05 12:34:56' | plus_time: days: 1, months: 1, hours: 1 | round_to_next: 'weekday' }}Basing a date on context
It's possible to base a date on a value from your task's context. For example, an expression like this would allow you to base a task's due date on a field from a form:
liquid
{{ context.ValuesForExport.my-date-control | plus_time: days: 1 }}If you need to use a value from context as an argument to the plus_time filter, you will need to convert it to a number first, because liquid properties are strings by default. The easiest way to do this is to use a variable and one of the built in maths functions. If you had this context <xml><minutes>12</minutes></xml>, then you could use an expression like this:
liquid
{% assign time = context.minutes | plus: 0 %} {{ "now" | plus_time: minutes: time }}Changing due date using a mutation
Due dates can also be updated in a mutation, either using the same kind of expression as described above, or by adding time to the current due date.
liquid
{{ task.ActivityContext.Due | plus_time: hours: 1 }}Previewing Dates
The "Preview Due Date" button allows you to check your due date expression, which can help you ensure that your expression is correct. If there are any errors in your expression then it will tell you.
If you've referenced context in your expression, then the preview will use the example input context that's saved in your workflow definition.