When setting the Issue summary via a groovy post script my KanBan board is not reliably updated

William November 19, 2019

Hi All,

 

when I update the summary of an issue (new or after an edit) via a groovy post function, the summary on the card on a Kanban board is not reliably updated. The summary changes in the issue and the detail view to the right, but the card on the board itself is not affected until it is edited or transitioned for the next time.

Here is the code I am using:

def im = ComponentAccessor.getIssueManager();
def issueToChange = im.getIssueObject(issue.id) as MutableIssue
issueToChange.setSummary(summaryString)
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def userManager = ComponentAccessor.getUserManager();
def user = userManager.getUserByName(currentUser.name)
im.updateIssue(user, issueToChange, EventDispatchOption.DO_NOT_DISPATCH, false)

I have discovered though that if I change the updateIssue() call to dispatch an Event

im.updateIssue(user, issueToChange, EventDispatchOption.ISSUE_ASSIGNED, false)

then everything works as expected. Unfortunately, as I am using a Listener to listen for many Issue event types, this leads to problems in preventing infinite loops, where I currently have to disable my script for the ISSUE_ASSIGNED event type (as this is the least important to me).

 

This feels very much like something that will eventually come back to bite me hard ;-)

So my question is: Can I either dispatch a custom event somehow (instead of ISSUE_ASSIGNED) or alternatively, is there some other way to trigger the cards on the kanban board to update themselves from a post function?

 

Regards

 

William

 

1 answer

0 votes
William December 3, 2019

Any feedback that may help me find a solution is appreciated, like if anyone knows which events exactly cause the board cards to be updated. I assume all of this is somehow related to caching.

Suggest an answer

Log in or Sign up to answer