Webhook not triggered on status transition

Hello, 

I have a workflow in Jira Cloud with the following statuses:

Open --> In Progress --> Done --> Open

I want a webhook to be triggered when the issues transition from In Progress to Done (In Progress --> Done). I did the following: 

  1. Created a Webhook for the "updated" issue event
  2. Added the following JQL: STATUS CHANGED FROM "In Progress" TO "Done"
  3. Saved the webhook

When testing the webhook, I get the following result: 

  • When the issue transitions from "In Progress" to "Done" the webhook is not triggered
  • But, when transitioning from "Done" to "Open" it is triggered. In fact it is also triggered for any transition thereafter. 

I understand why it is triggered for every transition thereafter, however I do not understand why it is NOT triggered when transition to "Done" in the first place. 

It appears as if the JQL is executed before the status has changed in the database and therefore it does not take into account the new status but the previous status. 

If the above is the case, then this is not documented behavior. Can you please help me? 

 

Thanks

1 answer

0 votes
Hello,
First of all jql query is executed upon the lucene index, not database. And are you sure that transition from In Progress to Done fires issue updated event? Have a look at the fired event on this transition.

I had a look at the jira event. Part of the JSON received is 

"webhookEvent":"jira:issue_updated"
Alexey Matveev Community Champion Nov 18, 2017

  But you said the web hook did not fire. How come there is a part of JSON received?

Hello Alexey and thanks for your time.

 

In fact, I said it did not fire on transitioning from "In Progress" --> "Done". Thereafter, the event triggers. So after the first transition from "In Progress" --> "Done" it gets triggered. Just so that I am more specific: 

  1. Create new issue (status "To Do")
  2. "Open" --> "In Progress" : Event is not triggered (expected behavior) 
  3. "In Progress" --> "Done" : Event is not triggered (UNEXPECTED behavior)
  4. "Done" --> "Open" : Event triggers (expected behavior - the issue has transitioned at least once from "In Progress" to "Done") 
  5. "Open" --> "In Progress" : Event gets triggered (expected) 
  6. "In Progress" --> "Done" : Event gets triggered (expected) 
  7. etc. 

 

Hope it is a bit more clear now. 

 

Thank you 

Alexey Matveev Community Champion Nov 18, 2017

What I meant go to the transition which goes from In progress to Done. Open post functions tab and have a look what event is fired there. If it is not issue updated event then either change it to the issue updated event or add this event to the webhook triggers.

Alexey Matveev Community Champion Nov 18, 2017

I think maybe it can be the issue resolved event which fires on this transition that is why the webhook does not fire because it is not the issue updated event.

Alexey Matveev Community Champion Nov 18, 2017

ah, sorry. Number 6 is from in Progress to Done and it fires. I guess the event is correct.

I checked the post functions, and I saw the following: 

 

  1. Set issue status to the linked status of the destination workflow step.
  2. Add a comment to an issue if one is entered during a transition.
  3. Update change history for an issue and store the issue in the database.
  4. Re-index an issue to keep indexes in sync with the database.
  5. Fire a Issue Closed event that can be processed by the listeners.

I think that the problem may be coming from the fact that at step 3 the change history is updated (and possibly Issue Updated event is fired) and then in step 4 the issue is re-indexed. As a result, my JQL running at step 3 may not see the issue as in status changes from "in progress" to "done". I will updated the post functions and try it again. I will post the update. 

Alexey Matveev Community Champion Nov 18, 2017

I guess that is the case:) Better add issue closed to the webhook trigger.

Unfortunately, I cannot change the order of the default Post Actions. I guess I am currently stuck with this for now. As a workaround, I can get the webhook to be called for every issue_update event and then check in my external application what the reason for the update was. Of course this is very bad practice since I will be getting a lot of traffic when only a small fraction of that is useful. 

How would I add Issue Closed to the webhook trigger? This is a fixed list where there is no "issue closed" event. See screenshot:

jirs-webhook-screenshot.jpg

Alexey Matveev Community Champion Nov 18, 2017

Yes, you are right. Not all events are available. I guess the only choice to add the update event. Or to fire it in the transaction as a post function.

Alexey Matveev Community Champion Nov 18, 2017

you can explicitly fire it from the transaction. Just add Trigger a webhook post function.

I could do this, the only reason that I have not done so is because I am aware that there is a bug open about triggers in post functions that do not fire reliably webhooks (see here).

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 ...

2,870 views 12 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