Webhook not triggered on status transition

kororos November 17, 2017

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

4 answers

2 votes
Darin Hafer July 16, 2018

I'm having same issue as Lefteris. My webhook is triggered on all updates of the issue, except for when it transitions to Done.

Since I can trigger the webhook in a workflow, I set the trigger in the transition to Done...and it never gets triggered. (Jira server 7.9.2).

Tried to make a workaround but this appears to be a bug.

0 votes
Faruk Cankaya May 22, 2019

Is there any progress in this issue? I've a similar problem, too. Let me clear it, I've 8 step in my workflow:

- Ready for Dev

- Test Fail

- In Dev

- Code Review

- Ready for Test

- In Test

- Ready For Deployment

- Done

I added webhook to "Test Completed" transition between "In Progress Test" and "Ready for Deployment" steps. Here are the post functions of the transition:

The following will be processed after the transition occurs

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

Expected behavior:

Trigger WEBHOOK TEST  function when an issue moves from In Test step to Ready For Deployment step. But webhook is not triggered. I checked activity of issue on this step and it seems that status is changed properly which says:

Faruk Cankaya changed the status to Ready for Deployment on X-1000 - Issue Name

 

However, webhook is triggered if an issue moves from "Ready for Deployment" to any another step which is unexpected behavior.

 

I think it's caused by the order of post functions. I fired the webhook transition at last after the 6. step named "Fire a Generic Event event that can be processed by the listeners." but the behavior was not changed.

 

Finally, my webhook configuration is like that:

Issue related events

JQL: project = PROJECTNAME AND status = "Ready for Deployment"

Issue: created, updated, deleted, worklog changed

Michael Lasonde June 10, 2019

Any kind of solution for this? i only want to get a webhook notification sent when Arch = Security and Status changes from Investigating to Escalated. Any help would be appreciated.

Faruk Cankaya May 12, 2020

Nope

Sonal Singh June 11, 2020

hey, I am new to JIRA and facing a similar issue. I need to trigger a database function based on the status change. say when the status changes to 'Ready for deployment' then JIRA should trigger a DB function.  I was thinking of using webhooks, any idea how this can be achieved.? TIA

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 17, 2017
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.
kororos November 18, 2017

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

"webhookEvent":"jira:issue_updated"
Like Vincent van ’t Zand likes this
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 18, 2017

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

kororos November 18, 2017

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
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 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
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 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
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 18, 2017

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

kororos November 18, 2017

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
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 18, 2017

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

kororos November 18, 2017

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. 

kororos November 18, 2017

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
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 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
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 18, 2017

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

kororos November 19, 2017

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

JDave May 14, 2019

Did you ever get anything to work?   The webhooks have not been updated or fixed .. I'm in the same situation .. with trying to launch a webhook when our incidents transition to Done

Like Carol Li likes this

Suggest an answer

Log in or Sign up to answer