Automatically sharing a new ticket with a specific Organization and add the reporter as a member of the Organization

お困りですか?

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

コミュニティに質問

Platform Notice: Cloud Only - This article only applies to Atlassian products on the cloud platform.

要約

This article shows how to use automation to set an organization field based on the reporter's membership with that organization. It also provides the option to add the customer to a specific customer organization.

環境

Jira Service Management Cloud

ソリューション

A scenario of how this knowledge article can apply if:

  • You have a Jira Service Management project and this project is only intended for a single Organization/Company. And,
  • You want every request created in this project to automatically share with all the members of the Organization by adding that Organization in the Organization field.
  • If the reporter is not part of the Organization yet, the automation will make sure to add the reporter as a member of the Organization.
  • This way, all other users/members of that Organization will be notified of any new ticket/request creation within the project.

In this article, Jira Service Management REST API will be used. Detailed steps to create the automation rule and the conditions of the automation rule will be presented further in the article. You can also import the example rule created for this article.

Example Automation Rule

Overview of the Automation rule

We will start with creating the automation rule for this action. You can follow the steps below to create your automation rule. There will be 4 different parts that you need to follow.

新しいルールを作成する手順は以下のとおりです。

  1. From your service project, select Project Settings Automation.

  2. 右上隅にある [ルールを作成] を選択します。

  3. ルールのトリガーを選択します。

  4. Select "Issue created" from the trigger settings and select Save.

  5. Select New component and choose New condition. "If block" should be selected.

  6. Select the "User condition" and configure accordingly.
  7. Select "New action" and choose "Edit Issues".
  8. Repeat steps 5-7 for the "else-if block".
  9. Select "New action" on your else-if block. Configure this step as shown in the below.

  10. [保存] を選択します。

  11. Give your rule a name, then select Turn it on.

Part 1: Tools and Components

Selecting Trigger

Automation rules in Jira cloud contain a number of triggers to use. For this rule, we will need the “Issue Created“ trigger.

Creating the If/else Block

In the rule, we’re aiming the check whether the reporter is a member of a certain customer organization. This will contain multiple options. Hence, we will be using the “If/else block“ condition.

Checking the user’s membership

To check whether a user from a user picker field(Reporter), “User condition“ can be used.

This condition verifies if a user is present or belongs to a specific group. You have the flexibility to include more criteria in this condition and choose whether all or any of the criteria need to be met.

Executing the action

In this rule, there will be two actions to be used. The initial step involves considering the positive condition, which entails including the customer as a member of the targeted customer organization. For this purpose, we will be using the “Edit Issue“ action.


Edit the current issue by selecting the field you want to modify and the value you want to add. In Jira Service Management, you have the ability to edit both Jira fields and Assets fields. To gain a deeper understanding of Assets in Jira Service Management, please refer to this link.


Part 2: Prerequisite information

Set up basic authentication for API.

  1. Create an API token following these instructions here: Get an API token

  2. Generate the base64 encoded authorization following the instructions here: Supply basic auth headers

Getting the organizationID

You can get the “organizationID” by calling the following endpoint.

https://<YOUR-SITE>.atlassian.net/rest/servicedeskapi/organization

Part 3: Adding a reporter as part of the Organization member

The second action we will take if the user is not part of this customer organization is the “Send Web request” action.

Sends a web request to notify another system when a rule is executed. You have the option to configure this action to return response data that can be utilized in a subsequent action.

Create the Web request

  1. Add an action: Send web request.

  2. Web request URL:

    1. https://<YOUR-SITE>.atlassian.net/rest/servicedeskapi/organization/<organizationID>/user
  3. Set the HTTP method to POST
  4.  Add the “Custom data“ which will contain the reporter information. To get the reporter’s information we will be using the smart values. “{{issue.reporter}}“ will return the reporter’s account ID.
    1. {
        "accountIds": ["{{issue.reporter}}"]
      }
  5. Add Headers: 
    1. Key: Content-Type
    2. Value: application/json
  6. Add another header
    1. Key: Authorization
    2. Value: Basic <ADD THE ENCODED STRING>

Test Send Web Request action

  1. Click on the Validate your web request configuration drop-down. 

  2. Enter an issue key and Validate the call.

  3. You should see a green Response 204.

  4. Click Payload to see the returned information.

Part 4: Finalize and validate all the steps

Putting together everything with the following steps, you’ll be creating the automation rule as shown below.

  1. Add Trigger

  2. Add If block

    1. Add positive “User condition” to the if block

    2. Add “Edit issue“ action to set the customer organization.

  3. Add the Else block

    1. Add the negative “User condition” to the else block

    2. Add the “Send web request“ action based on the information mentioned above

    3. Add “Edit issue“ action to set the customer organization.


You can always Contact Atlassian support if you have any questions. 


最終更新日: 2023 年 12 月 22 日

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

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