Running event update on all issues in a project

We calculate priority through a listener and 2 scripted fields. We have made a change and need to trigger issue update event on all issues in one of projects. Is there a way through script-runner to do this?

4 answers

1 vote

Likely a project reindex will do it for you. Test in staging of course

0 vote

I'm not sure I understand what/why you are you trying to update on the issues after you have calculated priority?

Because the listener adjust built in priority as well on issue update/create only. The arrows on all older closed issues and currently open issues before implementation are wrong. I have added the logic to a live service desk environment.

I just had to do something very similar - also with a listener that sets priority based on two custom fields. My use case was fixing issues imported from CSV for which the listener did not set priority (still not sure why). Rather than modify the existing listener, I created a second listener with pretty much the same code except listening for a custom event (that I also created) and without the check for updates to the custom fields (which were set correctly on import). I then used the following code to fire the custom event:

import com.atlassian.jira.component.ComponentAccessor

def user = ComponentAccessor.getUserManager().getUserByName('automation')

def iem = ComponentAccessor.getIssueEventManager()
iem.dispatchEvent(Long.valueOf(10100), issue, user, false)

That was done in a test script field. I then wrapped that with this: https://scriptrunner.adaptavist.com/latest/jira/recipes/misc/running-a-jql-query.html in order to fire the event on issues returned from a JQL query (project where priority was empty).

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Tuesday in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

152 views 1 17
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you