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-----