Use Automation to edit link formatting on Paragraph Fields

お困りですか?

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

コミュニティに質問

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

シナリオ

In this article, we'll describe how you can use Automation and Smart Values to format links added to your issues as Smart Links. This applies to:

  • Description Field: By default Smart Links are applied to all compatible URLs inside the description field upon issue creation, however the same does not happen when you edit the description field to include URLs.
  • Custom Paragraph Field: for custom fields the URL is not transformed in a smart link, neither during issue creation or edition.

Requirements and Limitations

This functionality is only applicable in the description field and Paragraph custom fields - which supports rich text. In this page you can find more information on how to create a custom field. In addition only compatible links will be transformed into smart links, a list can be found here.

Smart value notation for the smart links

Links can be formatted in three different ways, for each of them we will use a specific notation:

  • Inline Link: representation of the page title
    • Usage: [URL|URL|smart-link]
    • 例:
  • Inline Card: smart cards offer richer detail than links
    • Usage: [URL|URL|smart-card]
    • 例:
  • Embedded: interactive preview of link content
    • Usage: [URL|URL|smart-embed]
    • 例:

Create the Automation

Once you have your field set up, you can proceed to creating the automation that will handle your links.

There are several ways you can perform this, here we will cover two scenarios:

  • Detect the existence of a link in a field upon editing an issue.
  • Use an automation to create a Confluence page and populate a Jira custom field with the smart link.

Detect the existence of a link in a field upon editing an issue

When editing the description or paragraph custom field, you can add link references to other pages that might be useful in the issue resolution, you can use automation to format these links for better visibility.

  1. Inside your project, go to Project Settings > Automation 
  2. Click Create rule and set the rule according to the below:
    1. Trigger: Field value changed
      1. Fields to monitor for changes: Description
      2. Change type: Any changes to the field value
      3. 対象: すべての課題操作
      4. 保存します。 
    2. Action: Create variable
      1. Variable name: urlextract 
      2. Smart value:

        {{description.replaceAll("(\|smart-link)(?=(\]|\|))","")}} 


      3. 保存します。 
    3. Action: Edit issue 
      1. Under Choose fields to set... select: Description 
      2. Leave it blank
      3. Expand the More options menu and add:

        {
            "fields": {
                "description": "{{urlextract.replaceAll("(?<=\|)(.*?)(?=(\]|\|))","$1|smart-link")}}"
            }
        }
      4. 保存します。
    4. Publish your rule ad make sure it is enabled



メモ:

  • the example is using the smart-link formatting, however the same can be done with the other formatting types by using: smart-card or smart-embed, instead.
  • the example used the Description field, however the same can be applied to a custom field. If you need to apply this for a custom field, you can use the same rule replacing the references to the description field with references to your custom field, this page explains how you can find the smart values for your custom fields.



Jira offers the possibility of using automation to create confluence pages from your Jira issues, this page provides details on this functionality. In this example, we create a confluence page and add the link to it into a custom field inside the issue for reference.

  1. Inside your project, go to Project Settings > Automation 
  2. Click Create rule and set the rule according to the below:
    1. Trigger: Issue Created
    2. Action: Create page in Confluence
      1. Title: {{summary}}
      2. Space: choose Confluence space from the drop down
      3. : choose from the drop down
      4. 保存します。 
    3. Action: Edit issue 
      1. Under Choose fields to set... select: your custom field
      2. And add the smart link notation, using the smart values for your confluence page:

        [{{createdPage.url}}|{{createdPage.url}}|smart-link]
      3. 保存します。

  3. Publish your rule ad make sure it is enabled

メモ:

  • the example is using the smart-link formatting, however the same can be done with the other formatting types by using: smart-card or smart-embed, instead.
  • the example used the Issue Created trigger, however the same can be done to other triggers, the goals was just to provide an example on how to use the link transformation. More trigger examples can be found on this page.







最終更新日: 2024 年 2 月 6 日

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

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