Custom Event Fired by ScriptRunner doesn't have updated data in email

I have requirement that I am trying to fulfil using ScriptRunner.  Only send emails on issue update when issue is in certain statuses.  We have a 'Planned' status for issues and Assignees shouldn't get bombarded with emails while in this status. Once it progresses to the next status, "Active" (or other statuses) the assignee should get emails when the issue is updated.  I have this all setup using a custom event being triggered by a Script Listener (Fire event when condition is true).  It works great, very simple.  The only problem is that the email received doesn't contain the correct "changed" information.

It's like the custom event is fired before the issue is indexed or all the context to compute the changed values isn't transferred through the Script Listener.

Any assistance would be appreciated.  Is it a ScriptRunner bug? Is it a limitation of Jira?

1 answer

0 vote

It is possible that when you created this event to be triggered in the workflow in Jira that the order of operations are such that the issue is transition to a new state, then the event/email is generated, and then the indexes are updated.

I would recommend checking the specific workflow in question, and then check on this transition in question.  From there check the order of the workflow.  I would certainly want to make sure that Jira has reindexed the issue before trying to trigger this scripted event.  It is a pretty common thing to see when creating new post functions in workflows in Jira, they tend to be created at the top position.  For the sake of data accuracy, and giving the indexes a chance to update, in this case it's probably going to need to have that event near the bottom of the post functions.

thanks for the input.  in this case the event isn't being fired during a workflow transition.  its being fired by a Script Listener (Script Runner).  Is there a was to adjust the processing order when a task is updated?  That's not in the workflow editor that I know of.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Jul 10, 2018 in Marketplace Apps

If you’re an Atlassian app developer, you’ll want to know about Atlas Camp!

This September 6-7, hundreds of Atlassian App developers will flock to Barcelona Spain to build skills, discover product roadmaps, meet face-to-face with the Atlassian team, and learn how to extend t...

181 views 0 4
Read article

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