How to use JSM Customer's Organization information in Automation rules

Still need help?

The Atlassian Community is here for you.

Ask the community



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

Summary

A Jira Service Management customer's organization information is not available as a smart value to be reused in Automation rules. You can find all available smart values related to user fields here. 

Solution

Here we set up a Automation rule, that will allow you to reuse the Organization info for the Reporter. (Other user fields can be similarly queried)

Set up basic authentication for API.

  1. Create an API token following these instructions here: Get an API token
  2. Generate the based64 encoded authorization following the instructions here: Supply basic auth headers

Create the first Action in the Automation rule

In this step, we make an API call to the Get Organization JSM endpoint and use the Reporter's account ID to filter for orgs that the Reporter is a member of.   

Create a new Automation rule. For more information on this step, please refer to this article. 

For testing purposes, we recommend the use of Manually triggered.

  1. Add an action: Send web request.
  2. Web request URL:
https://<YOUR-SITE>.atlassian.net/rest/servicedeskapi/servicedesk/{{issue.Request Type.requestType.serviceDeskId}}/organization?accountId={{issue.reporter.accountId}}

Add Headers: 

    • Accept  application/json
    • Authorization Basic <ADD THE ENCODED STRING>  (Please refer back to the previous step here.)

Set the HTTP method to GET.

Make sure you check for Delay execution of subsequent rule actions until we've received a response for this web request.

JSM CLOUD 2023 Sept

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 200.
  4. Click Payload to see the returned information.

See an example below


Reuse information received in the payload

Add all organizations to a custom field value

On the same automation rule, add one more Action: Edit issue

Click on More options, add the following, where you replace the custom field ID with your field ID.

{
    "fields": {
        "customfield_10109": "{{webResponse.body.values.name}}"
    }
}


Add all the organizations to the ticket that the reporter is part of.

On the same automation rule, add one more Action: Edit issue

{
       "update": {
                      "organizations": 
                       [
                         {{#webResponse.body.values}}
                                     {"add": {{id}} }
                         {{^last}},{{/}}{{/}}
                        ]
    }
}



Last modified on Dec 25, 2023

Was this helpful?

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