We have script runner piad add on installed in our Jira Data Center. It provides a lot of functionalities out of the box that doesn't natively exist in Jira.
Just wondering if it can help in export of issues from jira in csv format, etc. where comments can be exported under one single column. By default comments get exported in separate columns which is each comment has its own column of its own and it becomes tedious to concatenate them later in excel.
I tried the below script but it doesn't work :-
import com.atlassian.jira.bc.issue.search.SearchService
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.search.SearchException
import com.atlassian.jira.web.bean.PagerFilter
import org.apache.log4j.Level
// The JQL query you want to search with
final jqlSearch = "project = UBT AND issuetype = Task"
// Some components
def user = ComponentAccessor.jiraAuthenticationContext.loggedInUser
def searchService = ComponentAccessor.getComponentOfType(SearchService)
// Parse the query
def parseResult = searchService.parseQuery(user, jqlSearch)
if (!parseResult.valid) {
log.error('Invalid query')
return null
}
try {
// Perform the query to get the issues
def results = searchService.search(user, parseResult.query, PagerFilter.unlimitedFilter)
def issues = results.results
issues*.key
issues.each { issue ->
def commentManager = ComponentAccessor.commentManager
def comment = commentManager.getComments(issue)
if (comment) {
comment.body
}
}
FileWriter attFds = new FileWriter("/jira_home/issues.csv")
attFds.write("COLUMN 1,COLUMN 2,COLUMN 3 \r\n")
attFds.close()
}
catch (SearchException e) {
e.printStackTrace()
null
}
All i would like to do is the below :-
Instead of doing the default native jira export of issues for a given JQL (includes all fields) where comments get exported in csv file in separate columns (each comment for each issue key in a separate column), i would like to do same export for the issues for a certain number of fields including comments but the export to a csv file should have all comments for a given issue key under one single comments column in a proper readable format. I am also fine just doing export of issue keys with its respective comments so i can merge them later into natively exported csv from jira that has all fields by deleting comments column and pasting the results for comments for the csv outputted via script runner against each issue key if that helps.
Thanks!
Hello Nati.
No, it doesn't, because that link wouldn't be an issueLink, it would be an external link. If you check the documentation, it says that it returns an IssueLink, which has objects and ids.
I am actually not sure if you check for confluence links without using the issueEdit event, and that would be a bit overkill.
Did this help at all? Can I help you further?
Cheers!
DYelamos
Hi Daniel and thanks for the answer!
I've posted the same question on Atlassian support and got this answer:
"Yes, it is supporting the create or delete the event from an external issue link. Do take note this feature is not to be used in notification schemes, it only used for writing a plugin or create webhooks to get informed about changes to your issue links."
Now I'm confused....
What do you think?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nati!
I am not going to contradict my hosts as you can imagine. I could have been wrong in which case I apologise. I would not know how to extract the information that you want from that event though...
Cheers!
DYelamos
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Daniel and thanks for the quick reply!
We're actually a client of Adaptavist's script runner and would like to try looking more deeply into how we can confirm this information and use these events using scripted field or scripted post function with Script Runner.
I hope it's the right place to do it, but please correct me if I'm wrong- could you help us find out how to extract this information using a script?
Thanks!
Nati Levi.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nati.
I could, let me do some investigation in these couple of days and get back to you. Is this very urgent? I'm a bit busy with a development. If it is, I could ask someone from customer support to get to you.
Cheers!
DYelamos
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Daniel,
That would be great!
I don't mind waiting. We'll be back to work on Sunday here.
But if it's any inconvenience to you, you can transfer our request to your support.
Thanks,
Nati Levi.
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.