The list below contains some use cases that can be realized using Smart text fields.
Make sure to come by once in a while since the number of use cases will grow over time.
For all examples marked with a , you do not even have to copy and paste the code. Simply search for the field in the expression editor.
Use cases and examples
Use case | Built-in | Parsing mode | Expression |
---|---|---|---|
All email addresses mentioned in the issue description | General | %{findPattern(%{issue.description},"(?<=mailto:)([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9_-]+)")} | |
Assignee groups | Jira expression | issue.assignee?.groups || "" | |
Attachment authors | Jira expression | issue?.attachments?.reduce((result,att) => result.set(att.author.displayName,""), new Map()).entries().flatten().filter(entry => entry != "") | |
Attachment filenames | General | %{issue.attachments} | |
Attachment mimetypes | Jira expression | issue?.attachments?.reduce((result,att) => result.set(att.mimeType,""), new Map()).entries().flatten().filter(entry => entry != "") | |
Comment authors | Jira expression | issue.comments.reduce((result, comment) => result.set(comment.author.displayName, ""), new Map()).entries().flatten().filter(entry => entry != "") | |
Components from all sub-tasks | General | %{distinct(fieldValue(%{issue.components}, subtasks()))} | |
Creation date of the linked epic | Jira expression | issue?.epic ? issue?.epic.created.toCalendarDate().toString() : "" | |
Field value validation | General | %{matches(%{issue.cfnnnnn},"6|7|8|9") ? "Valid":"Invalid"} The values entered as arguments in the matches() parser function can be replaced with different values or with a regular expressions to validate differently the value of the custom field. Please, note that it is necessary to replace nnnnn with the ID of the custom field. | |
First comment | Jira expression | issue?.comments[0]?.body?.plainText == null ? '' : issue?.comments[0]?.body?.plainText The text will be returned using wiki markup, e.g. bold text will be shown as *bold text*. | |
First comment author | Jira expression | issue?.comments[0]?.author?.displayName | |
Historical due dates | Jira expression | issue.changelogs.filter(changelog => changelog.items.some(item => item.fieldId == 'duedate' && item.from != null)). map(changelog => {duedateentry: changelog.items.filter(item => item.fieldId == 'duedate' )}). map(e => new CalendarDate(e.duedateentry[0].from).toString()).join(", ") | |
Issue ID | General | %{issue.id} | |
Issue type description | Jira expression | issue?.issueType?.description | |
Keys of linked issues in current project | General | %{filterByProject(linkedIssues(), %{issue.project.key})} | |
Keys of non-estimated sub-tasks | Jira expression | issue.subtasks.filter(s => s?.originalEstimate == null && s?.customfield_nnnnn == null).map(i => i.key).join(", ") Please, note that it is necessary to replace nnnnn with the ID of the custom field displaying the original estimate or story points. | |
Last assignee change author | Jira expression | issue.changelogs.filter(changelog => changelog.items.some(item => item.fieldId == 'assignee')).map(changelog => changelog.author.displayName)[0] || "" | |
Last comment | General | %{issue.lastComment} | |
Last comment author | Jira expression | issue?.comments[issue?.comments?.length-1]?.author?.displayName || "" | |
Last status change author | Jira expression | issue.changelogs.filter(c=>c.items.some(i=>i.field=="status"))[0]?.author?.displayName || "" | |
Last status change date | Jira expression | issue.changelogs.filter(changelog => changelog.items.some(item => item.fieldId == 'status')).map(changelog => changelog.created).concat(issue.created)[0].toString() | |
Lowest date and time from linked issues | Jira expression | let minDate = issue?.links.map(link => link.linkedIssue.customfield_nnnnn).filter( d => d != null); minDate.length > 0 ? new Date(minDate.reduce((a, b) => a < b ? a : b )).toString() : "" Please, replace nnnnn with the ID of a Date Time Picker custom field. | |
Lowest date from linked issues | Jira expression | let minDate = issue?.links.map(link => link.linkedIssue.customfield_nnnnn).filter( d => d != null); minDate.length > 0 ? new CalendarDate(minDate.reduce((a, b) => a < b ? a : b )).toString() : "" Please, replace nnnnn with the ID of a Date Picker custom field. | |
Parent assignee | General | %{parent.assignee.displayName} | |
Parent priority | General | %{parent.priority} | |
Parent reporter | General | %{parent.reporter.displayName} | |
Parent status | General | %{parent.status} | |
Percentage of completed child issues | Jira expression | let children = (issue.isEpic ? issue.stories : issue.subtasks); children.length ? (children.filter(child => child.resolution).length / children.length * 100 + '').slice(0, 4) + '%' : '' | |
Previous assignee | Jira expression | issue.changelogs.map(i=>i.items).flatten().filter(i=>i.field=="assignee").length>0 ? issue.changelogs.map(i=>i.items).flatten().filter(i=>i.field=="assignee").map(a=>a.fromString)[0] : "" | |
Previous issue status | General | %{issue.status.previous} | |
Previous reporter | Jira expression | let reporters= issue.changelogs.map(i=>i.items).flatten().filter(i=>i.field=="reporter"); reporters.length>0 ? reporters.map(a=>a.fromString)[0] == null ? "" :reporters.map(a=>a.fromString)[0] : "" | |
Priority description | Jira expression | issue?.priority?.description | |
Project category of issue | General | %{issue.project.category} | |
Project description | General | %{issue.project.description} | |
Project lead | General | %{issue.project.leadDisplayName} | |
Status description | Jira expression | issue?.status?.description | |
Sub-task assignees | General | %{distinct(fieldValue(%{issue.assignee.displayName}, subtasks()))} | |
Sub-task labels | General | %{distinct(fieldValue(%{issue.labels}, subtasks()))} | |
Sub-task reporters | General | %{distinct(fieldValue(%{issue.reporter.displayName}, subtasks()))} | |
Timely resolution assessment | General | %{{issue.resolutionDate} != null AND {issue.dueDate} != null ? ({issue.resolutionDate} <= {issue.dueDate} ? "Yes" : "No") : (datePart({system.currentDateTime}, RUN_AS_LOCAL) > {issue.dueDate} ? "No" : "")} |