You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.
View groupJoin the community to find out what other Atlassian users are discussing, debating and creating.
Hello,
I have the following code snippet as part of a scripted listener I am working on to set the assignee on a related issue. I seem to be close but I have unexpected behaviour when the code is successful, failure works as intended.
Case: I have an Epic, with three issues in the epic. One of those issues is type "Billing Request".
issueLinkManager.getOutwardLinks(epicIssue.id).each { issueLink ->
if (issueLink.issueLinkType.name == "Epic-Story Link") {
def linkedIssue = issueLink.destinationObject
if(linkedIssue.issueType.name == "Billing Request"){
def billingRequest = linkedIssue
log.info "Found Billing Request: ${linkedIssue.getKey()}"
if(billingRequest.status.name == "Validation"){
log.info "Billing Request in Validation"
def issueInputParameters = new IssueInputParametersImpl()
issueInputParameters.setAssigneeId(userName)
def updateValidationResult = issueService.validateUpdate(user, billingRequest.id, issueInputParameters)
def issueUpdateResult = issueService.update(user, updateValidationResult, EventDispatchOption.ISSUE_UPDATED, false)
log.info "Assignee set to ${userName}"
}
else log.warn "Assignee not set; Billing Request in status: ${billingRequest.status.name}"
}
}
}
EDIT: Not sure why the formatting is so bad... here's a screenshot of the same code more readable:
Here is the output from the log on success:
Why is log data being posted for the iteration's that failed? Since they are nested within the IF statement, wouldn't this only have one line per success which is exactly one issue in my test case? I don't understand why I would have so many lines in the log on a success. Failure seems to log as expected.
Any insight is appreciated!
Any chance you actually have 2 identical links between those two issues?
Maybe add a line at the top of your "each" block:
log.info "Examining issues link with id=$issueLink.id"
If you have a different id before each of the successes, that should give you a clue.
I do not have identical links.
I will try this and see what the results are when I have time. Thank you for the suggestion.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey there Cloud Community members! We’re excited to give you the first glimpse of the new home for business teams on Jira — Jira Work Management. Jira Work Management is the next generation of J...
Connect with like-minded Atlassian users at free events near you!
Find an eventConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.
Host an eventYou're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.