Automatically Share Tickets with All of a Reporter's Organizations in JSM Cloud

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

Summary

Customers in multiple organizations can't natively share new tickets with all organizations. A workaround automates adding all reporter organizations to the ticket's Organization field upon creation.

Prerequisites

Before proceeding to the 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, which will automatically create the result. Copy the generated code, as it will be used during the automation rule creation.
  3. Check your Organization field ID by:
    • Click the cog icon at the top right corner of your Jira page, select Issues, and then select the Custom fields option from the left menu.
    • To 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 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.

Last modified on Nov 27, 2024

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.