JIRA event listener not quite catching the event from workflow transition

gil November 4, 2017

I have an event listener plugin that works well to capture the events from issue edit.  However, when I leverage the workflow transition screen to update a field, it seems like this issue event is captured but things not working properly.  I observe that the block of code is called inside the listener plugin, but not each line of code is executed.  Does anyone has this issue?

3 answers

0 votes
Tasneem Bhyat August 26, 2021

Hi @gil ,

 

 

did you manage to find a solution to this please as I am facing an issue where I have reindex code is called, but looking at the logs, i see it its only being done after the listener is finised.

Thanking you

gil August 26, 2021

No.

0 votes
Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 6, 2017

How do you reindex? Provide your code

gil November 6, 2017

boolean bWasIndexing = ImportUtils.isIndexIssues();
ImportUtils.setIndexIssues(true);
ComponentAccessor.getIssueIndexManager().reIndex(issue);
ImportUtils.setIndexIssues(bWasIndexing);

Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 6, 2017

You said you have a plugin. I just had a look at my code. I do it the following way:

I import  IssueIndexManager component to the constructor of the listener and then if I need to do a reindex, I just execute the following line:

issueIndexManager.reIndex(issue);

 It works for me. I can not see much difference with your code. There must be something else in your code.

gil November 7, 2017

They will both work. Again, when the trigger is from the issue edit, everything works fine, and I have same code for both events.  It's just when the update comes from the transition, and this line of code is not executed, while other code got executed.

0 votes
Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 4, 2017

Hello, 

When you update a field in a transition it is not the same as you update a field on the edit screen. When you edit a field on the edit screen the issue updated event is generated. In a transition you define yourself what kind of event will be generated. It can be the issue update event,  it can be generic event,  it can be your custom event. You define it in the post functions of the transition.  That is why have a look what kind of event your transition generates. If it does not explain the behaviour of your listener then provide your code and the type of the event generated by your transition. 

gil November 5, 2017

Hi Alexey - I did not modify the list of in the post function for such transition.  The end of the list is to trigger a generic event.  I captured the issue generic event to do the processing and have the above-mentioned problem.  I event changed the last item in the list to trigger an issue update event, and still same problem.  All in all, my plugin is able to capture the trigger (I did some debugging to confirm this), but the processing is not done entirely.  For example, in one of the steps, I reindex this JIRA issue, and it's not being executed, where, when there's an update directly from the edit screen, all steps are processed.

Suggest an answer

Log in or Sign up to answer