Automation for Jira を使用して日付の差をカスタム フィールドに保存する正しい方法

プラットフォームの注記: Cloud のみ - This article only applies to Atlassian apps on the クラウド プラットフォーム上のアトラシアン製品にのみ適用されます。

要約

Jira 自動化を使用する場合、カスタム フィールドと期限との日付の差を新しいカスタム フィールドに保存するには、スマート値が必要です。この操作の式は、{{issue.customfield_10189.diff(issue.duedate).prettyPrint}} です。ただし、フィールドのタイプによってはエラーが発生する可能性があるため、新しいカスタム フィールドのタイプを選択するときは注意が必要です。

診断

Jira 自動化では、カスタム フィールドと課題の期限との日付の差を計算して保存するのが一般的です。上記のスマート値は、この日付の差を求めるための簡潔なソリューションを提供します。しかし、この結果を新しいカスタム フィールドに保存しようとする場合は、フィールド タイプが重要になります。

原因

Choosing an inappropriate field type for the custom field where the date difference is to be stored can result in errors. If a field of type 'Number' or 'Date Picker' is selected, Jira may encounter difficulties converting the result, which is a combination of both a number and text.For example, if you store a negative result (such as -4) in a Number field, the automation flow fails with this error: "Could not convert the field value to a number. Please ensure the value is a number, math expression, or smart-value that can be converted into a number

ソリューション

日付の差を正常に保存するには、次の手順に従います。

  1. テキスト カスタム フィールドを作成する:

    • [Jira 設定] > [課題] > [カスタム フィールド] に移動します。

    • [カスタム フィールドを追加] をクリックし、タイプとして [テキスト フィールド] を選択します。

  2. 自動化ルールを設定する:

    • 必要なときにトリガーされる自動化ルールを設定します。

    • ルール内でスマート値 {{issue.customfield_xxxxx.diff(issue.duedate).prettyPrint}} を使って日付の差を計算します。Replace customfield_xxxxx with the ID of your own date custom field. duedate refers to the work item's Due date field.

  3. 結果をテキスト フィールドに保存する:

    • 自動化ルールに、新規作成したテキスト カスタム フィールドにスマート値の結果を設定するアクションを追加します。

By choosing a 'Text' field type for the custom field, you ensure compatibility with the mixed-format result ("20 days") and prevent conversion errors.After the automation flow runs, open an affected work item and check that the Text custom field shows the date difference (for example, "20 days"). If the field is blank, check the flow's audit log for errors.

自動化ルールのスクリーンショット:

自動化を使用して 2 つの日付の日数の差を特定し、テキスト フィールドに保存する

更新日時: October 21, 2026

さらにヘルプが必要ですか?

アトラシアン コミュニティをご利用ください。