Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.
×Hi,
I want to export bulk issue with "all comments" with author name to excel sheet, and i used scripted field with following script:
import com.atlassian.jira.component.ComponentAccessor def comments = ComponentAccessor.commentManager.getComments(issue) if (comments) { comments.body }
It does the job, but it brings all the comments together in one line. Can someone please help to break each comments in to new line with author's name on the top of each comment?
I also tried to add the author name with following code:
comments.authorFullName
but it removes the comment and display only author's name.
Can someone please help me to achieve both (all comments with author's name) with clean format?
The variable you generate called "comments" is a list of objects, not a simple block of text. It's one object per comment on the issue. When you just splat it out into the result by saying comments.body, java is effectively taking a bit of a punt and assuming you want "recognisable text from the objects in this list"
What you need to do is iterate over the list, and pull what you need. The pseudocode in my head is to replace comments.body with
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can flexibly export comments to Excel with the Better Excel Plugin.
It represents comments with its own calculated fields concept, which doesn't require you actually creating custom fields in JIRA, just adding a couple of Groovy lines that define the value, type (numeric, text) and format (for numbers and dates) of the field.
Albeit you are welcome to create new calculated fields or modify the existing ones, these are available out of the box:
Excel comments | Text, user and date of all comments. It is a longer block of text that can be inserted into a single Excel cell. If you need only the first or last comments, and more granularity, see the next items. |
Excel first comment | Text, user and date of the first (earliest) comment. It is a block of text that can be inserted into a single Excel cell. If you need more granularity or better data types, see the next 3 items. |
Excel first comment text | The actual text of the first comment. |
Excel first comment user | The user who added the first comment. |
Excel first comment date | The date when the first comment was added. |
Excel last comment | Text, user and date of the last (latest) comment. It is a block text of that can be inserted into a single Excel cell. If you need more granularity or better data types, see the next 3 items. |
Excel last comment text | The actual text of the last comment. |
Excel last comment user | The user who added the last comment. |
Excel last comment date | The date when the last comment was added. |
You should be able to achieve what you want with zero or little work.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Nic Brough [Adaptavist] Since you are most active one that I know through the atlassion support tickets, can you please help?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.