Varying salutation based on a custom gender fieldIf-else
Code Block
language
xml
{{#if (exists issue.customfield_11111)}} <!-- Checkscheckaifcustomthegender field isand generatesfilledtheorsalutationemptyaccordingly -->
{{#if (existsissue.customfield_11111.raw)}}
{{#eq issue.customfield_11111.raw "m"}} <!-- check for the specific field value "m" -->
Dear Sir
{{/eq}}
{{#eq issue.customfield_11111.raw "f"}} <!-- check for the specific field value "m" -->
Dear Madam
{{/eq}}
{{else}} <!-- if the field is empty -->
Dear Sir or Madam
{{/if}}
Expand
title
Print all unique comment author names with format "#. Name"
Compare values via OR
Code Block
language
xml
{{#or (eq issue.priority.name "Medium") (eq issue.priority.name "High")}}
<!-- this will be executed if the issue's priority is either Medium or High -->
{{/or}}
Expand
title
Check if a value is set and NOT a specific value
Code Block
language
xml
{{#and (exists issue.summary) (compare issue.summary != "Test")}}
<!-- this will be executed if the issue summary is set but different then "Test"-->
{{/and}}
Expand
title
Modify a datetime and compare it
Code Block
language
xml
{{setVariable "14DaysAgo" (subtractDay now 14)}}
{{#if (isBeforeDay issue.created.raw 14DaysAgo)}}
<!-- this will be executed if the issue was created more than 14 days ago -->
{{/if}}
Expand
title
Loop over an array
Code Block
language
xml
<!-- Prints all people watching the issue -->
{{#each issue.watchers}}
{{this.displayName}}
{{/each}}
Expand
title
Map an array's property to a new array and loop over it
Code Block
language
xml
<!-- Prints all authors in the format "#. Name" -->
{{setVariable "commentAuthors" (pluck issue.comment "author.displayName")}}
{{#each (unique commentAuthors)}}
{{add @index 1}}. {{this}}
{{/each}}
Expand
title
Check if an issue is older than 14 daysFilter an array on a specific property
{{#or (eq "a" "b") (eq "c" "d") (eq "e" "f")}}
<!-- -->
{{/or<!-- Prints all comments from the issue's creator -->
<!-- for Jira DC it would be issue.creator.key // author.key -->
{{#filter issue.comment issue.creator.accountId prop="author.accountId"}}
Created: {{format this.created.raw "dateMed"}}
{{this.body}}
{{/filter}}
Expand
title
Look for first/last entry of an array
Code Block
<!-- Prints the last comment of an issue -->
{{#withLast issue.comment}}
{{this.body}}
{{/withLast}}
Code Block
<!-- Prints the filename of the first attachment of an issue -->
{{#withFirst issue.attachment}}
{{this.filename}}
{{/withFirst}}
Expand
title
Check on field values and print different outcomes
Code Block
<!-- Returns depending on the value of a multiselectfield of an issue -->
{{#eq issue.customfield_11111 "Yes"}}
This is the Yes block
{{/eq}}
{{#eq issue.customfield_11111 "No"}}
This is the No block
{{/eq}}
Expand
title
Print only parts of an array
Code Block
<!-- Prints only the first/last name of the assignee, instead of the whole name -->
{{{before (split issue.assignee ' ') 1}}}
{{{after (split issue.assignee ' ') 1}}}
Expand
title
Show me summaries of all linked issues / subtasks of an issue
Code Block
<!-- Prints all issue summaries of linked issues -->
{{#each issue.issuelinks}}
{{this.inwardIssue.fields.summary}}
{{/each}}
<!-- Prints all subtasks of an issue -->
{{#each issue.subtasks}}
{{this.fields.summary}}
{{/each}}
Expand
title
Abbreviate/remove parts of a name
Code Block
<!-- Removes "Companyname" from every reporters name, to print only the Name -->
{{remove issue.reporter “Companyname”}}