Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Iterating Issue History

Changes to issues are registered in the Issue History, but it is not known in advance how many changes are going to be made. You can iterate a section over all the history entries of an issue. This allows you to create a table that dynamically grows according to the number of changes dene. The notation is:

...

Code Block
titleExpand to see the sample code
collapsetrue
#{for historyEntries}
   ${fullname:HistoryEntries[n].Author} made changes ${dateformat("dd-MM-yyyy HH:mm:ss"):HistoryEntries[n].Created}
  #{for ch=HistoryEntries[n].ChangedItemsCount}
	Field Name: ${HistoryEntries[n].ChangedItems[ch].Field}
	Old Value:  ${HistoryEntries[n].ChangedItems[ch].From}
	New Value:  ${HistoryEntries[n].ChangedItems[ch].To}
  #{end} 
#{end}
 
or
 
#{for h=HistoryEntriesCount}
   ${fullname:HistoryEntries[h].Author} made changes    ${dateformat("dd-MM-yyyy HH:mm:ss"):HistoryEntries[h].Created}
   #{for ch=HistoryEntries[h].ChangedItemsCount}
	Field Name: ${HistoryEntries[h].ChangedItems[ch].Field}
	Old Value:  ${HistoryEntries[h].ChangedItems[ch].From}
	New Value:  ${HistoryEntries[h].ChangedItems[ch].To}
   #{end} 
#{end}

Iterating Issue Activity


Info

We suggest that you use the html function to render the data because almost all content is HTML, e.g., ${html:ActivityEntries[n].Title}

...

Below is an example of using the Activity iteration in an Excel template:

or

Iterating Issue Links

Because it is not known in advance how many linked issues exist for an issue, you can iterate a section over all the linked issues of an issue. This allows you to create a table that dynamically grows according to the number of existing linked issues. The notation is:

...

The image below demonstrates an example of an Excel template that iterates over linked issues.

or

Iterating Issue Comments

Because it is not known in advance how many comments exist for an issue, you can iterate a section over all the comments on an issue. This allows you to create a table that dynamically grows according to the number of existing comments. The notation is:

...


The image below demonstrates an example of a Word template that iterates over issue comments.

or

For a working example of this functionality, check the SampleIterations.docx template in the Template Store.

The image below demonstrates an example of an Excel template that iterates over issue comments.

or

Info
titleJira Service Desk

If you are using Jira Service Desk you can see more information about comments here.

Iterating Issue Worklogs

Because it is not known in advance how many worklogs exist for an issue, you can iterate a section over all the worklogs of an issue. This allow you to create a table that dynamically grows according to the number of existing worklogs. The notation is:

...

For a working example of this functionality, check the SampleIterations.docx template in the Template Store.

The image below demonstrates an example of a template in Excel that iterates over issue work logs.

or




Iterating Issue Subtasks

Because it is not known in advance how many subtasks exist for an issue, you can iterate a section over all the subtasks of an issue. This allows you to create a table that dynamically grows according to the number of existing subtasks. The notation is:

...

For an example of how to iterate the details of a subtask Parent issue, please check the Iterating JQL Queries area below.

Iterating Issue Components

Because it is not known in advance how many components exist for an issue, you can iterate a section over all the components of an issue. This allows you to create a table that dynamically grows according to the number of existing components. The notation is:

...

 The image below demonstrates an example of an Excel template that iterates over issue components.

 

Iterating Issue Status Transitions

Because it is not known in advance how many Status Transitions exist for an issue, you can iterate a section over all the Status Transitions of an issue. This allows you to create a table that dynamically grows according to the number of existing status transitions. The notation is:

...

The image below demonstrates an example of a Word template that iterates over status transitions.

or

The image below demonstrates an example of an Excel template that iterates over status transitions.

or

Iterating Issue Attached Images

Because it is not known in advance how many Images can exist for an issue (as an attachment), you can iterate a section over all the attached images of an issue to get some metadata about them. This allows you to create a table that dynamically grows according to the number of existing images. The notation is:

...

The image below demonstrates an example of an Excel template that iterates over attached images. 

 

or

Iterating Issue Attachments

Because it is not known in advance how many attachments exist in an issue, you can iterate a section over all the attachments of an issue. This allows you to create a table that dynamically grows according to the number of existing attachments. The notation is:

...

The image below demonstrates an example of a Word template that iterates over attachments.

or

The image below demonstrates an example of an Excel template that iterates over attachments.

or

Iterating Issue Labels

Because it is not known in advance how many labels exist in an issue, you can iterate a section over all the labels of an issue. The notation is:

...

The image below demonstrates an example of an Excel template that iterates over labels.

or

Iterating Project Versions from an Issue

You can iterate over all project versions to which the issue belong to. The notation is:

...

The image below demonstrates an example of an Excel template that iterates over project version.

or

Iterating JQL Queries

You can iterate issues that are the result of a JQL Query. The syntax is similar to the other iterations, but there is a clause parameter that will receive the JQL Query. A few examples are provided below.

...

Info

You can also use a Filter Name or a Filter Id as a clause. For more info, read this.


Iterating Issue Commits

Because it is not known in advance how many commits exist for an issue, you can iterate a section over all the commits of an issue. This allows you to create a table that dynamically grows according to the number of existing commits. The notation is:

...

Code Block
titleExpand to see the sample code
collapsetrue
#{for commits}
	${Commits[n].Author} 
	${Commits[n].URL} 
	${Commits[n].Message}
	${Commits[n].CreatedDateTime}
	
	Here we have the FilesCount where we can get all the files associated with a commit.
	#{for m=Commits[n].FilesCount}
		${Commit[n].FilesCount[m].Path}
		${Commit[n].FilesCount[m].URL}
		${Commit[n].FilesCount[m].ChangeType}
	#{end}
#{end}
 
or
 
#{for <VariableName>=CommitsCount}
   Content and Issue Mappings. Example: ${Commits[VariableName].Field}
#{end}

 

Iterating Issue Branches

Because it is not known in advance how many branches exist for an issue, you can iterate a section over all the branches of an issue. This allows you to create a table that dynamically grows according to the number of existing branches. The notation is:

...

Code Block
titleExpand to see the sample code
collapsetrue
#{for branches}
  ${Branches[n].URL}
  ${Branches[n].Name}
  ${Branches[n].RepositoryName}
  ${Branches[n].RepositoryURL}
#{end}
 
or
 
#{for <VariableName>=BranchesCount}
   Content and Issue Mappings. Example: ${Branches[VariableName].Field}
#{end}

 

Iterating Issue Pull Requests

As it is not known in advance how many pull requests exist for an issue, you can iterate a section over all the pull requests of an issue. This allows you to create a table that dynamically grows according to the number of existing pull requests. The notation is:

...

Code Block
titleExpand to see the sample code
collapsetrue
#{for pullRequests}
  	${PullRequests[n].URL}
  	${PullRequests[n].Name}
  	${PullRequests[n].RepositoryName}
  	${PullRequests[n].RepositoryURL}
	${PullRequests[n].CommentsCount} (This represents the number of comments in a pull request)
	${PullRequests[n].Status}
	${PullRequests[n].LastUpdated}
 
	Here we have the PullRequestReviews where we can get all the reviewers for this pull request.
	#{for m=PullRequests[n].PullRequestReviewers}
  		${PullRequests[n].PullRequestReviewers[m].Name}
  		${PullRequests[n].PullRequestReviewers[m].Approved}
	#{end}
#{end}
 
or
 
#{for <VariableName>=PullRequestsCount}
   Content and Issue Mappings. Example: ${PullRequests[VariableName].Field}
#{end}

 

Iterating Issue Builds

 Because it is not known in advance how many builds exist for an issue, you can iterate a section over all the builds of an issue. This allows you to create a table that dynamically grows according to the number of existing builds. The notation is:

...

Code Block
titleExpand to see the sample code
collapsetrue
#{for builds}
  	${Builds[n].ProjectName}
  	${Builds[n].ProjectKey}
	
	Here we have the each Build Plans where we can get all the individual plans for this project and the correspondent build in existence for this plan.
	#{for m=Builds[n].Plans}
  		${Builds[n].Plans[m].Key}
  		${Builds[n].Plans[m].Name}
  		${Builds[n].Plans[m].BuildNumber}
  		${Builds[n].Plans[m].BuildKey}
  		${Builds[n].Plans[m].BuildDuration}
  		${Builds[n].Plans[m].BuildFinishedDate}
	#{end}
#{end}
 
or
 
#{for <VariableName>=BuildsCount}
   Content and Issue Mappings. Example: ${Builds[VariableName].Field}
#{end}

 

Iterating Issue Reviews

Because it is not known in advance how many reviews exists for an issue, you can iterate a section over all the pull requests of an issue. This allows you to create a table that dynamically grows according to the number of existing reviews. The notation is: 

...

Code Block
titleExpand to see the sample code
collapsetrue
#{for reviews}
  	${Reviews[n].Id}
  	${Reviews[n].URL}
  	${Reviews[n].Status}
  	${Reviews[n].Title}
  	${Reviews[n].Author}
  	${Reviews[n].Moderator}
	
	Here we have the Reviewers for each review where we can get all the individual reviewers for this review.
	#{for m=Reviews[n].Reviewers}
 		${Reviews[n].Reviewers[m].Username}
  		${Reviews[n].Reviewers[m].Completed}
	#{end}
#{end}
 
or
 
#{for <VariableName>=ReviewsCount}
   Content and Issue Mappings. Example: ${Reviews[VariableName].Field}
#{end}


Applying filters to Iterations

If you want to take the previous iterations over comments, subtasks and issue links to another level of control, you can use a JavaScript filter to define over which issues the iteration will be made. This can be useful in the following scenarios:

...

It is also possible to format fields inside iteration filters. For more information on formatters, see Native Iterations.

The image below demonstrates an example of a template that iterates over issue links and comments with filters being applied.

...

For a working example of this functionality, check the template Sample Iterations in the Template Store.

Iterating in the same line of the document

You can also possible to iterate values in the same line of the document. This can be useful if you want to display a list of Subtasks on Linked Issues in the same line, separated by commas or spaces. 

...

Code Block
titleExpand to see the sample code
collapsetrue
Users that added comments to this issue: #{for comments}${Comments[n].Author} #{end}

Subtasks of this issue: #{for j=SubtasksCount}${Subtasks[j].Key};#{end}

Linked issues this issue duplicates: #{for j=LinksCount|filter=%{'${Links[j].LinkType}'.equals('duplicates')}}${Links[j].Key} #{end}


Iterating in the same cell in an Excel document

You can also iterate values in the same cell in an Excel document. You can achieve this by simply making your Iteration inside the same cell.

...

Code Block
titleExpand to see the sample code
collapsetrue
Issue iteration as a demonstration.
Copy this iteration below and paste it into a cell.
 
&{for issues} ${Key} &{end}

Iterating with the BREAK or CONTINUE statement

You can iterate anything, set up a Conditional expression and then utilize the BREAK and CONTINUE statements.

...

Code Block
titleExpand to see the sample code
collapsetrue
Imagine that you have a Jira Issue that contains these comments:
- Hello
- World
- Greetings
- Hi
 
For the Break functionality, lets say that you want to stop the iteration if the current comment is "World". Here is the template for that:
#{for comments}
Current Comment: ${Comments[n].Body}
#{if (%{'${Comments[n].Body}'.equals('World')})}
#{break}
#{end}
Current Comment Author: ${Comments[n].Author}
#{end}
In this case, it will print the comment "Hello" and it´s author. Next it will print the comment Body "World" but since the Conditional expression is true, it will stop the iteration all together and not print anything else.
Note: Anything after the #{break} mapping will not be printed in the exported document.
 
For the Continue functionality, lets say that you want to skip to the next iteration if the current comment is "World", bypassing the Author mapping for this iteration. Here is the template for that:
#{for comments}
Current Comment: ${Comments[n].Body}
#{if (%{'${Comments[n].Body}'.equals('World')})}
#{continue}
#{end}
Current Comment Author: ${Comments[n].Author}
#{end}
In this case, it will print the comment "Hello" and it´s author. Next, it will print the comment Body "World" but since the Conditional expression is true, it will continue to the next iteration, not printing the Author of the "World" comment.

Iterating Parent Issues

You can iterate a section over all the parent issues of an issue. This allows you to create a table that dynamically grows according to the information you want to see from parent issues.

...

Code Block
titleExpand to see the sample code
collapsetrue
&{for issues|filter=%{'${IssueTypeName}'.equals('Sub-task')}}
   ${Parent.Key}
   ${Parent.Summary}
   ${Parent.Description}
   ${wiki:Parent.Description}
   ${html:Parent.Description}
   ${dateformat(“dd-MM-yyyy HH:mm:ss”):Parent.date}
   ${emailaddress:Parent.userpicker}
&{end}

This example only has a few fields, but this new feature allows you to get all information from a parent issue.


Sorting iterations

Imagine that you have an iteration and want to sort it by any field that it can export normally. This will be the header for such an iteration:

...

Code Block
titleExpand to see the sample code
collapsetrue
This iteration will be sorted by the Body of all the comments in the issue.

#{for comments|sortby=Body}
${Comments[n].Author}
${Comments[n].Body}
#{end}

Sort By on multi issue  export

The sortby can also be used to sort a &{for issues} iteration on a Bulk Export.

...