Automatically share a ticket with all reporter’s organizations

お困りですか?

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

コミュニティに質問

要約

In case your customers are members of multiple organizations, they're not natively able to share their tickets with all organizations during a tickets' creation. A work around for this scenario is creating an automation rule that triggers every time a new ticket is created and sends a web request to a specific endpoint that returns all organization IDs the reporter is part of. Having this information the same automation rule will update the ticket's Organization field with all these values and the ticket will be consequently shared across all the organizations the reporter is part of.

Pre requisites

Before proceeding to the actual automation rule creation, you will need the following:

  1. An Atlassian API token. In case you still don't have one, you should create it by following our Manage API tokens for your Atlassian account documentation. Note that after creating the token you won't be able to see it again, therefore you should copy and store it somewhere else to be used as reference during this process.
  2. After having the Atlassian API token, you will need to encode your credentials with base64. It can be done using any online tool such this example. Just fill the first text field using the following format:
    • <EMAIL>:<API_TOKEN>
    • Supposing your email address is atlassian@atlassian.com, it should be filled as: atlassian@atlassian.com:xxxxxxxxxxxxxxxxx
    • In the above example, xxxxxxxxxxxxxxxxx should be replaced with the API token code created in the first step.
    • Now hit the Encode button and it will automatically create the result. Copy the generated code as it will be used during the automation rule creation.
  3. Check your Organizations field ID by:
    • Click the cog icon at the right upper corner of your Jira's page, select Issues and then select Custom fields option from the left menu.
    • Filter for the Organizations field, click the three dotted sign in front of it and select the View field information option. 
    • The respective field ID will be shown at the end of your URL as highlighted below. Save the field's ID as it may be necessary during the automation rule creation as well:


                             

Creating the mentioned automation rule

In case you're not experienced in creating automation rules refer to our Create and edit Jira automation rules, but the following steps should guide you through the process:

  1. From your service project page, select Project settings and then Automation options from the left menu.
  2. Hit the Create rule button at the right upper corner of your page.
  3. Select the automation rule's trigger that in this case should be Issue created, so it triggers whenever a new ticket is raised. After selecting it click the Save button.
  4. Now click New action, search for the Send web request option and select it. Fill it as follows: 
    • Web request URL: 

      {{baseUrl}}/rest/servicedeskapi/organization?accountId={{reporter.accountid}}
    • First Header's name: Accept
    • First Header's value: application/json
    • Second Header's name: Authorization
    • Second Header's value: Basic xxxxxxxxxxxxxxx
    • HTTP method: GET
    • Web request body: Empty
    • The final result should look like the following:

      Note that the xxxxxxxxxxxxxxx from the second header's value should be actually replaced with the encoded result generated from the second pre requisites' step.

  5. Hit the Save button.
  6. Select New action once again and now search and select the Edit issue option. 
  7. Click More options and fill the Additional fields text box as follows:


    {
        "fields": {
            "customfield_10002": [{{webResponse.body.values.id}}]
        }
    }


    By Jira's default, the Organizations field is represented by the customfield_10002 custom field ID. If during the third pre requisite's step you noticed it has a different value you should update the above code to the respective field ID.

  8. Hit the Save button.
  9. Now you just need to name your automation and hit the Turn it on button, which will publish and enable the automation rule.

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

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

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