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.

Attachments
There are no attachments for this article.
Feedback
Security Code
Related Articles
Adding Existing Applications In a Workspace
Viewed 108 times since Wed, Apr 8, 2020

How to explore a problem
Viewed 98 times since Tue, Mar 3, 2020

About Requestor Workspaces
Viewed 108 times since Wed, Dec 5, 2018

Step 7: Configure Application: Create a Workflow
Viewed 202 times since Wed, Dec 5, 2018

About Applications
Viewed 203 times since Wed, Dec 5, 2018

Step 3: Create a Workspace
Viewed 169 times since Wed, Dec 5, 2018

Co-term Alignment of Comindware Subscriptions
Viewed 92 times since Wed, Dec 5, 2018

Objects
Viewed 100 times since Wed, Dec 5, 2018

Tasks due date approach reminders
Viewed 96 times since Wed, Dec 5, 2018

Configuring an Export Template
Viewed 144 times since Wed, Dec 5, 2018