Hi all,
We currently have a post-function script to update the status of the parent issue(s) when all the linked issue(s) status are Closed and/or Passed. The problem we are having is that when trying to get the status of the linked issue that triggers the post function script, it shows different results where on the first part of our script the result is correct but on the second part it shows the status prior to the transition.
Snippet of script in question:
final String jqlSearch = "issue in linkedIssues(${issue})"
log.warn("issue: " + issue) log.warn("jql string: " + jqlSearch) log.warn("issue status: " + issue.getStatus().getName())
and
final String jqlQuery = "issue in linkedIssues(${it.key})"
SearchService.ParseResult parseNewResult = searchService.parseQuery(user, jqlQuery)
log.warn("Checking linked issue(es) and status")
if ( it.issueType.name == "Test-Case" ) {
if (parseNewResult.isValid()) {
def linkedResults = searchService.search(user, parseNewResult.query, PagerFilter.unlimitedFilter)
def linkedIssues = linkedResults.results
linkedIssues.each {
def linkedIssueStatus = it.getStatus().getName()
log.warn("Linked issue and status: " + it.key + " : " + linkedIssueStatus) }
Checking the logs we added, we could see that there is a difference on the result of the script (see line 3 and line 7 of logs)
2020-05-06 17:53:50,779 WARN [workflow.AbstractScriptWorkflowFunction]: issue: ABC-589 2020-05-06 17:53:50,779 WARN [workflow.AbstractScriptWorkflowFunction]: jql string: issue in linkedIssues(ABC-589) 2020-05-06 17:53:50,779 WARN [workflow.AbstractScriptWorkflowFunction]: issue status: Closed 2020-05-06 17:53:50,788 WARN [workflow.AbstractScriptWorkflowFunction]: Checking parent issue(es) and status 2020-05-06 17:53:50,791 WARN [workflow.AbstractScriptWorkflowFunction]: Parent issue and status: ABC-45 : Blocked 2020-05-06 17:53:50,791 WARN [workflow.AbstractScriptWorkflowFunction]: Checking linked issue(es) and status 2020-05-06 17:53:53,805 WARN [workflow.AbstractScriptWorkflowFunction]: Linked issue and status: ABC-589 : Client Review 2020-05-06 17:53:56,806 WARN [workflow.AbstractScriptWorkflowFunction]: Linked issue and status: ABC-588 : Passed 2020-05-06 17:53:59,806 WARN [workflow.AbstractScriptWorkflowFunction]: Linked issue and status: ABC-583 : Closed 2020-05-06 17:54:02,807 WARN [workflow.AbstractScriptWorkflowFunction]: Linked issue and status: ABC-577 : Passed 2020-05-06 17:54:05,808 WARN [workflow.AbstractScriptWorkflowFunction]: Linked issue and status: ABC-576 : Passed 2020-05-06 17:54:08,808 WARN [workflow.AbstractScriptWorkflowFunction]: Linked issue and status: ABC-571 : Passed
Line 3 shows the updated status of the issue while line 7 shows the status before the transition. Is there any way for the it.getStatus().getName() value on line 7 be the same to the updated value on line 3?
Thanks and regards
For this one, as we were not able to find a clear cut solution what we did as a workaround was to not include the issue triggering this post function script to a counter we use for comparison. Not entirely sure if there is a cleaner way to this.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.