Skip to Content

Comindware Expression Language examples

Assign a Value to a Field of a Workflow Item

Let’s consider the example in which a value is assigned to a field of a workflow item depending on a value of another field of the same workflow item. For example, you might need to show the remaining time until the deadline, when your workflow item is in particular status. The remaining time should be calculated as the difference between the... Read More


Check if a Field Is Empty

You can check if a field is empty and perform the required actions depending on a returned value. For example, you may want to mark requests, software bugs, or issues that were rejected and group them to the list. For this purpose use both IF and EMPTY functions. To add the rule: 1. Select a workspace, select an application. 2. Click «Fields» and c... Read More


Return the List of Items the Current Item Is Referenced by

You can see link relationships of an item. For example, if you send a request to purchasing department for stationery, you may want the all related invoices to be shown in the workflow item representing this request. The real difficulty in showing invoices may arise, if the invoices reference the request, but the request doesn't reference invo... Read More


Create a Time Stamp for Each Workflow Transition

You can make time stamps on entering a workflow step or on transition execution. Create the required number of fields of the Date/Time type and drag them into the form. In our example the «Time Stamps» tab was created to contain all the time stamps. To configure a time stamp rule: 1. Select a workspace, select an application inside a workspace. 2. ... Read More


Calculate and Log Active Time Spent on a Workflow Step

Let’s calculate and log active time spent on a workflow step. To do so, the following rule should be added to transition rules. To add the rule: 1. Select a workspace, select an application inside a workspace. 2. Create the required number of fields of the Date/Time type. 3. Create several fields of the Duration type for logging active time o... Read More


Assign a Manager to a Workflow Task Depending on the Priority

Let's assign a manager to a workflow task depending on the workflow item priority. For this example we use the IF function. To create the rule: 1. Select a workspace, select an application inside a workspace, click «Fields». 2. Create the «Request Priority» (ID: Request_Priority) field of the List of Values type. This field is required for cr... Read More


Return Information from a Related Item

If you store any data as documents, you can get all required information from them and show it on your workflow item form. To do so, you should make a reference to the application your workflow item belongs to. To retrieve particular data from a related item, use the following expression pattern:  $Reference_Field_ID->Related_Item_Field_ID ... Read More


Assigning a task to the manager of a user

Every user record within CMW Tracker has the ""manager"" property which defines just that - the manager of the user in question. You can specify the manager manually or have this field synced with the manager property in your Active Directory. This is not just a static property though, you can pull it up and use it in your workflows and data field ... Read More


Auto numbering

In order to pre-populate a certain field with the count of all IDs in the current app +1, thus, getting a unique consecutive number for an item (invoice no, request #, etc.), enter the following expression: @prefix cmw: <http://comindware.com/logics#>.@prefix cmwmath: <http://comindware.com/logics/math#>.@prefix math: <http://ww... Read More


Calculating a table inside a text field

If you want to send some data in the form of a table in, for example, an email notification, insert the following expression: FORMAT("<table width=800 align =Left> <tr><th width=500><h2>{0}</h2></th> <th width=100><h2>Wirkung %</h2></th> <th width=100> <h2>Datum</h2>... Read More


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 ... Read More


Calculating next recurrence date

In order to calculate next recurrence date for a certain item, enter the following expression: Date format: @prefix cmw: <http://comindware.com/logics#>.@prefix str: <http://www.w3.org/2000/10/swap/string#>.@prefix schedule: <http://comindware.com/ontology/schedule#>.{  ?item cmw:schedule ?scheduleId.  ?scheduleId schedule:las... Read More


Capturing comments from triggers

In order to capture comment text to pre-populate certain field or to use in an email use trigger of type “On comment addition” and enter the following expression in the necessary activity:  $$contextComment->cmw.comment.value Read More


Conditions for transitions based on limits

CMW Tracker provides the ability to configure conditional transitions. In particular, it may be useful in the approval processes to determine whether the approval by a specific employee is needed or not. Usually, approval limits for the required set of employees / roles are set up in some other technical application, and the conditions for the tran... Read More


Configuring the display of the "Date / Time" attribute

In order to customize the display of the date in a certain format (in this example it is “«1» March 2021"), enter the following expression: FORMAT("«{0}» {1} {2}", LIST(DATETIMEDAY($date), IF ((DATETIMEMONTH($date) == 1), "January", IF ((DATETIMEMONTH($date) == 2), "February", IF ((DATETIMEMONTH($date) == 3), "March", IF ((DATETIMEMONTH($date) ... Read More


Converting attachments into text

In order to convert attachments into text attribute (for example, to get the list of names of these attachments, or to have clickable links to them), enter the following expression: Attachments from current item only (subtasks attachments not included): Link: @prefix cmw: <http://comindware.com/logics#>.@prefix xsd: <http://www.w3.or... Read More


Converting discussion into text

In order to convert all the comments in the discussions tab of an item to a separate text field (for instance, to use for export), enter the following expression:   @prefix cmw: <http://comindware.com/logics#>. @prefix comment: <http://comindware.com/ontology/comment#>. @prefix sort: <http://comindware.com/ontology/dataset/sort#&... Read More


ID of User Account’s attributes

In order to return any user data in the system (for example, full name or E-mail), you need to know the system names of the attributes of user accounts. The following list contains basic user attributes that can be used in various expressions and formulas: System name Name Data type cmw.account.fullName Full name Text cmw.account.manager Man... Read More


Pulling elements out of a Date/Time field

This article describes how to extract just separate parts (e.g. day/month/year) from a Date/Time field. This could be useful, for example, to cut off the time when writing a custom description or when sending a custom email notification. This can be done using the FORMAT function. Here's an example: FORMAT("{0:MM:yyyy}", LIST($creationDate)) S... Read More