Troubleshoot IF ELSE Block Condition in Scheduled Jira Automation Rules
プラットフォームについて: Cloud と Data Center - この記事は クラウド プラットフォームとデータセンター プラットフォームの両方に等しく当てはまります。
Server* 製品のサポートは 2024 年 2 月 15 日に終了しました。Server 製品を実行している場合は、 アトラシアン Server サポート終了 のお知らせにアクセスして、移行オプションを確認してください。
*Fisheye および Crucible は除く
要約
IF/ELSE ブロック条件を含む予定された自動化ルールは、期待どおりに動作するために複数回の実行する必要が生じる場合があります。
診断
The Automation rule has a Scheduled trigger (with JQL) and at least one IF / ELSE block
例
IF (condition A)
THEN action A
ELSE IF (condition B)
THEN action B
ELSE IF (condition C)
THEN action C
ELSE
THEN action D
On the first execution of the rule, only action A is performed.
On the second execution of the rule, only action B is performed, or action A is performed again.
On the third execution of the rule, only action C is performed, and so on.
IF/ELSE ブロックのすべてのアクションを実行するには、数回連続して実行する必要があります。
原因
これは、実際に Automation for Jira で IF/ELSE ブロックが動作する方法です。
In Scheduled rules, the Conditions are applied to the set of Issues as fetched by the trigger JQL as a whole—the opposite of iterating over each issue individually.
例
For a set of 10 issues or work items, if condition A results in a non-empty result, then action A is executed, and the IF / ELSE block is done.
If condition A results in an empty result, then if condition B results in a non-empty result, action B is performed and the whole Block is done.
This may be counterintuitive to programmers, who may expect that each action would be applied to the given issues that match the respective conditions:
3 issues updated with action A,
2 issues updated with action B,
4 issues with action C, and so on.
We have an open suggestion to add this caveat to the documentation: JIRAAUTOSERVER-209 - Improve documentation on the IF ELSE condition behavior
ソリューション
Separate the conditions
Make use of several IF / ELSE blocks separated from each other:
IF (condition A)
THEN action A
IF (condition B and not A)
THEN action B
IF (condition C and not A and not B)
THEN action C
IF (condition "not A and not B and not C")
THEN action D
⚠️ CAREFUL: Each condition must be mutually exclusive. That means any issue that fulfills condition A must not fulfill any of the other conditions.
視覚的な例

この内容はお役に立ちましたか?