How to handle two web-hooks triggered when a issue is transitioned from one status to another via board
プラットフォームについて: Cloud のみ - この記事は クラウド プラットフォームのアトラシアン製品に適用されます。
要約
If you have webhooks configured in Jira for issue_updated event then you will get two webhook payloads when you move an issue from one status column to another in Sprint or Kanban board.
環境
Jira Cloud
診断
n/a
原因
When you transition an issue from one status to another by moving it from one status column to another in the board, you also change the Rank of the issue as you move it above or below the issues in the new column. Rank is a custom field available by default in Jira and is not visible to users. When this is changed, it triggers a separate issue_updated event. Thus, you see two webhook events, one for the status transition of the issue and one for the change in the Rank of the issue.
ソリューション
Option 1:
If you prefer not to use Ranking at all then you can disable ranking by removing the Order by Rank clause from the Board filter query.
To enable ranking:
Go to your board, then select more (***) > Configure Board.
Go to the board filter and click the Edit Filter Query button.
- Remove the "ORDER BY Rank ASC"(or Desc) clause and save the filter.
This will disable ranking for the board and prevent the webhook from being triggered for Rank change.
オプション 2:
If you would like to keep your rank field then you can try to ignore the payload triggered for the Rank field at your destination by using the changelog field in the JSON.
As you can see in the screenshots above the changelog differs for each webhook event triggered from Jira based on what field was updated.
Using this information you can try to filter out events in the receiving end by checking if the field value in the changelog property is set to "Rank".