Skip to Content

Calculating custom text field values based on values in other fields

In certain cases you may need to automatically compose text field value using text you already have in other fields. 

For example, you may need to auto-generate a workflow task title to contain case id, employee name, date of the request and some custom text so all of your tasks are named using the same format. In this particular scenario you will need to go to the Workflow Scheme settings of your App and add an expression language formula to pre-define the value for the Title field in the first step in your workflow.

To calculate the custom text as described above, you need to use the FORMAT function when writing the expression language formula.

Example of the expression:

 FORMAT(""Request number {0} from {1} on {2}."", LIST ($id, $employee_1->cmw.account.fullName, $date_1))

where:

  • FORMAT - function used to calculate custom text using field values. 
  • {0} {1} {2} - placeholders that show where you want field values to be placed in the resulting text. Each number in {curly braces} takes data from the LIST operator according to its index number, starting with 0.
  • LIST - contains ids of fields to take data from. Value from the field that is listed first will be put in place of {0}, second one will go to {1} and so on.
  • $id - returns current item id.
  • $employee_1->cmw.account.fullName - returns account name of the user specified in the field with the id of ""employee_1"".
  • $date_1 - returns date from the field that has the id of ""date_1"".

 

Use this formula to pre-populate the Title field in the ""Pre-populate Fields"" settings tab in the first step of your workflow:

Expression for pre-populatin the Title

Save all your changes.

This is what the final result will look like in the product interface after you create a workflow task:

Title