古いデータを失うことなく既存のカスタム フィールドのコンテキストを変更する

お困りですか?

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

コミュニティに質問

説明

データを入力済みの既存のカスタム フィールドのコンテキストを変更する必要がある場合があります。この操作では、コンテキストの変更後にこれまでのすべての課題を更新することが必要になる場合があり、データが失われる可能性があります。この操作により、カスタム フィールドを新しいバックエンド データで強制的に更新することで、Jira インターフェイスには変化が見られませんが、履歴データの整合性を確保することができます。

There is a related bug currently tracked in  JRASERVER-62455 - Getting issue details... STATUS

シナリオ

"Example List" という名前の "選択リスト" カスタム フィールドが存在し、次の値が入力されています。

  • Value One
  • Value Two
  • Value Three
  • Value Four

既定値を持たない既存のコンテキストがあります。

The "Example List" field is used in the projects "Example Project 1 - No Default" and "Example Project 2 - Default." This field has been in use on both projects for some time, so both projects have issues with this field populated.

目標

Change the context for the "Example List" without losing the data previously entered into the custom field for "Example Project 2 - Default."

完了すると次のようになっているはずです。

プロジェクトカスタム フィールド既定値
Example Project 1 - No DefaultExample List (古いコンテキスト)(なし)
Example Project 2 - DefaultExample List (新しいコンテキスト)"Value Three"

In other words, the "Example List" custom field will stay the same, including the existing values from those issues that have already been created, but new issues in the "Example Project 2 - Default" project will have a default value for "Example List."

"Example Project 1 - No Default" will not undergo a change of context for the "Example List" custom field, so no further action will be necessary.


注意

If you have a test environment, please utilize it for your own testing before making any changes on your live instance of JIRA. Either way, we highly recommend backing up your data before proceeding.

Solution 1 - From custom context to custom context

This solution applies when you are moving between two custom contexts:

  1. Assign your new context (with a default value) to "Example Project 2 - Default"
  2. Issues >> Search issues に移動します。
  3. "Example List" カスタム フィールドに入力されたそれぞれの値について、次の手順を実行します。
    1. JQL Search: Project = "Example Project 2 - Default" AND "Example List" = someValue
    2. [ツール] > [一括変更]
    3. すべての課題を選択して [次へ] をクリック
    4. [課題を編集] を選択して [次へ] をクリック
    5. "Example List" ボックスを選択して任意の値を選択し、[次へ] をクリック
    6. 変更を確認して [確認]
プロセスの例を展開して確認...

(info) "Value One" 値のプロセスは次のようになります。

  1. Issues >> Search Issues
  2. JQL Search: Project = "Example Project 2 - Default" AND "Example List" = "Value One"
  3. [ツール] > [一括変更]
  4. すべての課題を選択して [次へ] をクリック
  5. [課題を編集] を選択して [次へ] をクリック
  6. "Example list" ボックスを選択して "Value One" を選択し、[次へ] をクリック
  7. すべての課題を "Value One" から "Value One" に更新することを確認し、[確認] をクリック


Solution 2 - From custom context to default (global) context

This solution applies when you want to change back into the default context:

  1. First, we have to identify the ID of the Custom field we want to modify. Go to Issues > Custom Fields > Affected Custom Field > Configure and take note of its ID from the URL (e.g., /secure/admin/ConfigureCustomField!default.jspa?customFieldId=10701)
  2. Then we will have to identify the IDs of the current context and the default scheme context, you can also verify and note this information from the URL, when configuring the context (e.g. /secure/admin/ManageConfigurationScheme!default.jspa?fieldConfigSchemeId=11001&customFieldId=10701)
  3. Now on the database you have to retrieve each individual option ID, that is associated with the custom field project-specific context and also from the default context:

    SELECT id,customvalue FROM customfieldoption where customfield = customFieldId AND customfieldconfig = fieldConfigSchemeId;  
  4. Note down all the IDs and values. Then remove the project-specific Context.
  5. Jira を停止します。
  6. When you delete the context the customOption IDs still remain, however they no longer link to any context, therefore it’s empty on the UI.
  7. If you recreate the context, a new set of IDs will be generated, which do not match the previously existing ones, still resulting in "data loss"
  8. What we aim do to now is to replace the IDs from the custom values of the delete context with equivalent ones from the default context. To achieve this, for EACH customvalue, perform the following:

    update customfieldvalue set stringvalue='DefaultContextcustomvalueID' where stringvalue ='CustomContextcustomvalueID';
  9. Start Jira, verify that the values are now displayed in the customfield


Related Articles:

カスタム フィールド コンテキストの設定

グローバル コンテキストを持つカスタム フィールド

Last modified on Mar 21, 2024

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

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.