Comindware Knowledgebase

Assign a value to a field of workflow task

Let’s consider the example in which a value is assigned to a field of a workflow task depending on a value of another field of the same workflow task. For example, you might need to show the remaining time until the deadline, when your workflow task is in particular status. The remaining time should be calculated as the difference between the due date and the current server date. And then the calculated value should be assigned to the specified field.

For this example the IF, OR and SUBTRACT functions should be used.

To configure the rule:

1. Select a workspace, select an application.
2. Click Fields.
3. Create the Due Date (ID: Due_Date) field of the Date/Time type.
4. Create the Remaining Time field of the Duration type. This field will display the remaining time until the deadline, depending on the status of the workflow task.

Go to the attributes of the Remaining Time field and select the Calculated check box. The Field Expression tab becomes available.

5. Obtain the identifiers of required fields and workflow statuses. For example:
workflowState - the identifier of the workflow task system field, which represents the current status of the workflow task.
wfstate.approvedImplementation, wfstate.ReviewbyManager - the identifiers of the workflow statuses Implementation and Review. You can replace them with identifiers of your custom workflow statuses.
6. Type the following expression into the built-in editor:

IF

(

OR

(

$workflowState == ID("wfstate.approvedImplementation"), $workflowState == ID("wfstate.ReviewbyManager")

),

SUBTRACT($Due_Date, $$now),

DURATION("PT600S")

)

7. Click Save&Close.
8. Go to Form and drag the created fields to the workflow task form. Save the changes.

To check how the created rule works, create a new workflow task and move it through workflow. When the workflow task will be in Implementation or Review status, the Remaining Time field will display the difference between the due date and the current server date. Otherwise, the constant value will be assigned to the field (10 minutes in our example) in order to verify the functionality of our expression.

Send you request to Comindware Still need help? Contact us

See Also

Back to top