Hi folks,
I have a groovy script that works great for me and gives me what I need. I am trying to make a little change though. It displays a table for me with all the data but I need it in ASC order of the "Product Portfolio" column. Below are the full script and I am also attaching a screenshot of how the table looks like. Any help would be really appreciated. I hope everyone is staying safe during this crazy pandemic time.
Thanks,
Shahriar
--------start script -------
import com.atlassian.jira.component.ComponentAccessor
import groovy.xml.MarkupBuilder
def issueLinkManager = ComponentAccessor.getIssueLinkManager()
def links = issueLinkManager.getOutwardLinks(issue.id)
def writer = new StringWriter()
def xml = new MarkupBuilder(writer)
if(!links){
return null
}
xml.style(type:"text/css",
'''
#scriptField, #scriptField *{
border: 1px solid black;
}
#scriptField{
border-collapse: collapse;
}
''')
xml.table(id:"scriptField"){
tr{
th( "Key")
th("Summary")
th("Status")
th("Product Portfolio")
th("Target Delivery Date")
th("Fiscal Year")
th("Quarter")
}
links.each {issueLink ->
def productPortfolio = ComponentAccessor.getCustomFieldManager().getCustomFieldObject(15327)
def targetDeliveryDate = ComponentAccessor.getCustomFieldManager().getCustomFieldObject(15103)
def fiscalYear = ComponentAccessor.getCustomFieldManager().getCustomFieldObject(14402)
def quarter = ComponentAccessor.getCustomFieldManager().getCustomFieldObject(15326)
def keyInvestmentArea = ComponentAccessor.getCustomFieldManager().getCustomFieldObject(15718)
def additionalCategory = ComponentAccessor.getCustomFieldManager().getCustomFieldObject(15851)
def productOwner = ComponentAccessor.getCustomFieldManager().getCustomFieldObject(10000)
def linkedIssue = issueLink.destinationObject
if (linkedIssue.issueType.name == "Epic")
tr{
td(linkedIssue.key.toString())
td(linkedIssue.summary.toString())
td(linkedIssue.status.getName().toString())
td(linkedIssue.getCustomFieldValue(productPortfolio))
td(linkedIssue.getCustomFieldValue(targetDeliveryDate))
td(linkedIssue.getCustomFieldValue(fiscalYear))
td(linkedIssue.getCustomFieldValue(quarter))
}
}
}
return (writer.toString())
-------end script-----
Sorting by that custom field would need to be done in the JQL that finds your issues. The script you show is processing each issue
Hi Matt,
Thanks for your response.
What should I change in my script to sort the data by that field?
You mentioned that it needs to be done in the JQL, how and where exactly?
Thanks,
Shahriar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.