What I've done so far all seems to be working well:
What is left is that I want to replace my 'Disposition' column with the lozenge instead of the plain text status.
What the table currently publishes as:
What I'd like to appear in the last column:
Additionally, I'd like to have them not truncated.
An alternative solution I'd also be open to (if it is easier to implement) is to add another column that uses the getStatusCategory() to simply list the To Do/In Progress/Done status lozenge and have the disposition remain as plain text.
The current code:
import com.atlassian.jira.component.ComponentAccessor
import groovy.xml.MarkupBuilder
import org.apache.log4j.Logger
import org.apache.log4j.Level
def log = Logger.getLogger("com.DRTable.GenerateTable")
def issueLinkManager = ComponentAccessor.getIssueLinkManager()
def links = issueLinkManager.getOutwardLinks(issue.id)
def customFieldManager = ComponentAccessor.getCustomFieldManager()
log.setLevel(Level.DEBUG)
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;
}
th {text-align:center
}
td {
padding: 10px;
}
tr:nth-child(even) {
background-color: #eee;
}
tr:nth-child(odd) {
background-color: #fff;
}
''')
xml.table(id:"scriptField"){
tr{
th("Identity")
th("Type")
th("Catagory")
th("Severity")
th("Summary")
th("Disposition")
}
links.each {issueLink ->
def linkedIssue = issueLink.destinationObject
def issueID = linkedIssue.id
def cfType = customFieldManager.getCustomFieldObjects(issue).find {it.name == 'Comment Type'}
def cfSeverity = customFieldManager.getCustomFieldObjects(issue).find {it.name == 'Severity'}
def cfCategorization = customFieldManager.getCustomFieldObjects(issue).find {it.name == 'Categorization'}
log.debug issueID
log.debug linkedIssue.issueTypeId
log.debug linkedIssue.status
if(linkedIssue.issueTypeId == "10410"){
tr{
td(linkedIssue.key.toString())
td(linkedIssue.getCustomFieldValue(cfType))
td(linkedIssue.getCustomFieldValue(cfCategorization))
td(linkedIssue.getCustomFieldValue(cfSeverity))
td(linkedIssue.summary.toString())
td(linkedIssue.status.getName().toString())
}
}}
}
return (writer.toString())
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.