Insight - automatically delete Objects that are not created by Import tasks

お困りですか?

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

コミュニティに質問

プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Fisheye および Crucible は除く

プラットフォームについて: Data Center のみ - この記事は、Data Center プラットフォームのアトラシアン製品にのみ適用されます。

この KB は Data Center バージョンの製品用に作成されています。Data Center 固有ではない機能の Data Center KB は、製品のサーバー バージョンでも動作する可能性はありますが、テストは行われていません。サーバー*製品のサポートは 2024 年 2 月 15 日に終了しました。サーバー製品を利用している場合は、アトラシアンのサーバー製品のサポート終了のお知らせページにて移行オプションをご確認ください。

*Fisheye および Crucible は除く

目的

Some organizations have a requirement to only retain assets that got loaded from certain external imports, and to delete the assets located in other sources (or created manually). The requirement becomes even more complex if an asset can be updated from several different sources.

This article provides guidelines on how to:

  • Configure Insight to mark Objects for deletion if they are missing and not found in other import source either, and
  • Delete those Objects automatically if they are marked for deletion.

ソリューション

The idea is to introduce a boolean attribute, that will indicate whether an Object is missing and is therefore flagged for deletion. We will use the Insight Import specific behaviour where a "false" boolean value is set to an boolean attribute for every Object that has its identifier present (in other words, for every Object that will be present in the import source).

手順

  1. In your Object Schema, create a boolean attribute that will serve to mark an Object for deletion. Do note, since the Import assigns "false" value to the attribute for Object that exists, we need to invert the naming logic - which is why in this example, we will use name "Attribute marked for deletion":
  2. In the Import rule:
    1. Set "Missing objects: Update" policy > select "Asset marked for deletion" in "Attribute to edit" field > set "true" in "New value of attribute to edit" field. This will make sure that the Object gets marked as missing if it is still not found after the threshold has been reached.
    2. Set Threshold as per your needs, so that the Object gets marked for deletion after the threshold has been reached
    3. Map the identifier locator to the boolean attribute "Asset marked for deletion". The attribute will adopt value "false" for every Object that is located in the source (which means the Object exists).
    4. Repeat this procedure for other Import rules, in case you are updating the same assets from multiple Import sources.
  3. Now, set up an Insight Automation rule, that will run with the trigger you desire, look for objects marked for deletion and invoke a DELETE REST request to Insight REST endpoint designated to delete the object with the current Object ID (<baseURL>/rest/insight/1.0/object/${objectId}) - check REST API documentation for more information.

注意

  • Automation trigger can be set to run after all imports updating the Objects have already run
  • For example, if we have 2 imports running at the same day, we can schedule the Automation to clean the Objects afterwards (during the night or the next day).
説明 Insight - automatically delete Objects that are not created by Import tasks
製品Insight
Last modified on Mar 14, 2023

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

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