The sorting has broken when value in the script field is changed without editing a JIRA issue.
- I created a script field and enable for Story type.
- The script that I created, it is used for getting the number of Open Bugs that are being linked to that Story.
import com.atlassian.jira.component.ComponentAccessor
def closeNames = ["Closed", "Resolved"]
def issueLinkManager = ComponentAccessor.getIssueLinkManager()
def issueLinks = issueLinkManager.getInwardLinks(issue.id)
def subElements = issueLinks.findAll {
it.getIssueLinkType().getName() == "Bug to Story"
}.findAll {
!(it.sourceObject.status.name in closeNames)
}.findAll {
it.sourceObject.issueTypeObject.name == "Bug"
}
return subElements.size() as Double
- The result on the script field returns properly.
For example: I have 2 Stories, SPT-6 and SPT-23
SPT-6 has 2 opened bugs (SPT-20 and SPT-53) -> The script field shows "2"
SPT-23 has 3 opened bugs (SPT-21, SPT-57, SPT-74) -> The script field shows "3"
The result shows correctly, including sorting by using ORDER BY ASC or DESC
- When I close some bugs, e.g. SPT-21 and SPT-57, the script field still calculates correctly, it show "1", instead of "3" on Story SPT-23. But the sorting has broken, it's not updated until I edit any field in SPT-23 or re-indexing JIRA.
Please help investigate, is this a bug or is there any solution to fix this problem?
Thank you in advance. Any question on my information above, please let me know.
Regards,
Orawan.