How to handle issue update/index timing in listener plugin?

I'm writing a Listener plugin that will update some related issues at the time when the relationship is created or removed between the two issues. I am running a JQL search to determine the data needed to populate on these related issues. However, i've run into an issue suddenly regarding the time delay of the updates to the triggering issue and when those updates are available to be queried.

So, my listener runs the query but only sees related information as if there were no change to the issue causing this trigger (in the case of removal, the relationship still seems to be there).

I'm wondering if there is a Order of Operations document, or a way to force a delay in when the listener will actually run compared to when the event is thrown.

It seems like i'm running into a problem where the indexing of the issue being changed which is throwing the event and therefore triggering the listener is not completing in time for the JQL query to return the correct up-to-date results from the index.

Let me know if anyone else has run into this and if there is a workaround or if i'm just left to my own devices in order to handle the exceptions in code.


1 answer

Hi Adam,

I did something similar recently where I created a jelly script closing tickets that are linked to.

Instead of running to query within the listener, I have created a saved/shared filter and run that via Jelly. See the snippet of that below. It works like a charm.

<JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.enterprise.JiraTagLib" xmlns:core="jelly:core" xmlns:log="jelly:log" >
<jira:Login username="someuser" password="somepassword">
    <log:info>Running Close issues service</log:info>
    <!-- Properties for the script -->
    <core:set var="comment">This ticket is closed as it is deployed to PROD. See the linked ticket for deployment above under Issue Links section.</core:set>
    <core:set var="workflowStep" value="261" />
    <core:set var="workflowUser" value="someuser" />
    <core:set var="ClosedasD2PCM" value="18133" />
    <!-- Run the SearchRequestFilter -->
    <jira:RunSearchRequest filterid="${ClosedasD2PCM}" var="issues" />
    <!-- Iterate over the issues -->
    <core:forEach var="issue" items="${issues}">
        <log:warn>Closing issue ${issue.key}</log:warn>
        <jira:TransitionWorkflow key="${issue.key}" user="${workflowUser}" workflowAction="${workflowStep}" comment="${comment}" resolution="Deployed to PROD"/>

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,075 views 13 18
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot