Jira Values in Expressions
Many Jira fields hold an object, not a text: a status is {id, name, statusCategory, …}, a select list option {id, value}, a user {accountId, displayName, …}.
The field itself stands for the part you mean where an expression compares it (==, !=, ===, !==, <, > …),
joins it to a text (+, String()), searches it in a list (includes, indexOf, lastIndexOf, join) or calls a method of a text on it.
${cur.fields.resolution == 'Done'} is ${cur.fields.resolution.name == 'Done'}
${pi.fields.customfield_10050 == 'Yes'} is ${pi.fields.customfield_10050.value == 'Yes'}
${pi.fields.components.includes('Backend')} finds the component with the name BackendThe full addressing still works: ${cur.fields.resolution.name == 'Done'} gives the same result as before. Existing models do not need to be changed.
On a sequence flow after an activity, on a conditional boundary event, and in the loop condition of a task with a loop marker, the status or resolution of the work item can be checked in the properties panel without an expression, see Choose a Status or Resolution.
The Fields
The rules go by the type of the value, not by the field id: a custom field of the same type, in a company-managed or a team-managed space, gets the same rule as the system field.
| Field (system field or custom field type) | Short form | Full form (still works) | The short form stands for |
|---|---|---|---|
| Status | cur.fields.status == 'Done' | cur.fields.status.name == 'Done' | name (also matches the id) |
| Status category | cur.fields.status.statusCategory == 'Done' | ….statusCategory.name == 'Done' | name (also matches key, e.g. 'done') |
| Resolution | cur.fields.resolution == 'Done' | cur.fields.resolution.name == 'Done' | name |
| Priority | pi.fields.priority == 'High' | pi.fields.priority.name == 'High' | name |
| Work type | cur.fields.issuetype == 'Bug' | cur.fields.issuetype.name == 'Bug' | name |
| Space (project) | pi.fields.project == 'FLOW' | pi.fields.project.key == 'FLOW' | name, also matches key and id |
| Assignee, reporter, creator, user picker | cur.fields.assignee == 'Jane Doe' | cur.fields.assignee.displayName == 'Jane Doe' | displayName; also matches the account id (Cloud) and the user name and key (Data Center) |
| User picker (multiple users), approvers and request participants (JSM) | pi.fields.customfield_10053.includes('Jane Doe') | pi.fields.customfield_10053[0].displayName == 'Jane Doe' | each user: displayName |
| Group picker | pi.fields.customfield_10060 == 'jira-users' | ….name == 'jira-users' | name |
| Select list (single choice), radio buttons | pi.fields.customfield_10050 == 'Yes' | pi.fields.customfield_10050.value == 'Yes' | value (also matches the option id) |
Assets (formerly Insight) objects with a value | pi.fields.customfield_10070 == 'Laptop 42' | ….value == 'Laptop 42' | value |
| Checkboxes, select list (multiple choices) | pi.fields.customfield_10051.includes('Red') | pi.fields.customfield_10051[0].value == 'Red' | each option: value |
| Select list (cascading) | pi.fields.customfield_10052 == 'Germany', ….child == 'Berlin' | ….value == 'Germany', ….child.value == 'Berlin' | the parent value; the child stays .child |
| Components | pi.fields.components.includes('Backend') | pi.fields.components[0].name == 'Backend' | each: name |
| Fix versions, affects versions, version picker | pi.fields.fixVersions.includes('3.7.1') | pi.fields.fixVersions[0].name == '3.7.1' | each: name |
| Sprint | pi.fields.customfield_10020.includes('Sprint 12') | ….customfield_10020[0].name == 'Sprint 12' | each: name |
| Team | pi.fields.customfield_10001 == 'Team Flower' | ….name == 'Team Flower' | name (or title where the answer of Jira has no name) |
| Organizations (JSM) | pi.fields.customfield_10002.includes('ACME') | ….customfield_10002[0].name == 'ACME' | each organization: name |
| Security level | pi.fields.security == 'Internal' | pi.fields.security.name == 'Internal' | name |
| Parent, linked work items, sub-tasks | pi.fields.parent == 'FLOW-1' | pi.fields.parent.key == 'FLOW-1' | key |
| Request type (Jira Service Management) | pi.fields.customfield_10010 == 'Technical support' | ….requestType.name == 'Technical support' | the name of the request type |
| Watchers | pi.fields.watches >= 3 | pi.fields.watches.watchCount >= 3 | watchCount |
| Votes | pi.fields.votes > 4 | pi.fields.votes.votes > 4 | votes |
| Progress, ÎŁ Progress | pi.fields.progress >= 50 | pi.fields.progress.percent >= 50 | percent |
| Attachment | pi.fields.attachment.includes('contract.pdf') | pi.fields.attachment[0].filename == 'contract.pdf' | each: filename |
| Description, environment and rich text fields (Atlassian Document Format) | pi.fields.description.includes('urgent') | the nodes of content | the plain text |
| Text, number, date, labels, URL | unchanged | unchanged | — |
The shortcut works too: pi.priority is pi.fields.priority, so ${pi.priority == 'High'} is the same condition.
Details
- What the short form matches: a text or number is compared with the value in the table and with the ids of the object (
value,name,displayName,key,id,accountId,title,filename).${cur.fields.status == 3}compares the id of the status.===compares with the type: the id of a status is the text'3'. - A field without a value stays empty:
${pi.fields.customfield_10050 == null}is true, a comparison with a text is false. - Two fields are compared as before: they are equal only if they are the same object. To compare the status of two work items, write
${pi.fields.status.name == cur.fields.status.name}. - A property is read from the object, not from its text:
${pi.fields.customfield_10050.length}is empty (an option has no length). - Not changed:
flowerVariables(pi.properties.flowerVariables…), texts, numbers, dates and lists of texts such as labels. - Objects of any other shape stay objects. A field whose value has none of the parts in the table keeps its full addressing, for example time tracking (
pi.fields.timetracking.originalEstimate), comments (pi.fields.comment.comments[0].body), worklogs, and the satisfaction rating of Jira Service Management. The complete list of rules is below. - What changes for existing models: only a condition that compared a whole object with a text. It was always false before (and
!=always true), because the object was compared as the text[object Object].
The Rules in the Code
The table above shows the fields. The engine decides by the shape of the value, in this order:
Generated from bit.flower master by util/generate-specs.mjs. Do not edit this section by hand.
The rules in the code, in the order they are tried
The first rule that fits the object gives its short value. The rules go by the shape of the object: every field whose value has this shape follows the rule.
| Order | The object stands for | Condition | Fields (examples) |
|---|---|---|---|
| 1 | value | – | select list (single), radio buttons, cascading select (the parent; the child stays .child.value), checkboxes and multi-select (each item), Insight/Assets options with value |
| 2 | displayName | – | assignee, reporter, creator, user pickers (single and multi), approvers of JSM; Data Center users too (their name is the user name, displayName the full name) |
| 3 | name | – | status, resolution, priority, issuetype, project, components, fixVersions, versions (affects), statusCategory, security level, sprint, team (Atlassian team), group pickers, version pickers, request type of JSM (requestType) |
| 4 | title | – | objects with a title and no name (Atlassian team in some answers) |
| 5 | key | the object also has fields or id | parent, linked work items (inwardIssue/outwardIssue), subtasks: the key, e.g. FLOW-12 |
| 6 | watchCount | – | watches |
| 7 | votes | – | votes |
| 8 | percent | – | progress, aggregateprogress |
| 9 | filename | – | attachment (each item) |
| 10 | its text (Atlassian Document Format) | – | description, environment and rich text custom fields as Atlassian Document Format (REST API 3): their text |
| 11 | the name of its requestType | an object with requestType.name | request type of Jira Service Management |
A comparison with a text or number matches the short value and these parts of the object: value, name, displayName, key, id, accountId, title, filename.