How to add Jira Service Management customers automatically to Organization based on reporter email domain

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

This article is about using automation to add customers automatically to their corresponding or new organizations based on the reporter's email address. At the same time, it will add the reporter's corresponding Organization to the Organizations field.

To learn more about customer Organization, please visit:

Cause

The following feature request tracks an improvement to automatically adding users based on their email domain to Organizations:

JSDCLOUD-4519 - Getting issue details... STATUS

Solution One

Use the steps below to configure an Automation rule to automatically add the reporter of an issue to the Organization corresponding with their email domain.

  • Go to Project Settings > Automation > Templates > Select Set organization using reporter's email domain.
  • The default trigger is Issue Created and you can always change it accordingly.

 

  • Click on the Edit issue fields Action to set the organization field on the issue based on the reporter's email address by selecting Use reporter's e-mail domain:
    • Make sure to select the box for "Create organization if it doesn't exist" to make sure that the organization will be automatically created in case it does not exist.


Once the new issue is created, you should see the following:

  • The reporter's email address will be added automatically to the Organization in the project's Customers list. You can verify this by navigating to your Service project > Customers > select the reporter's organization to see if the reporter has been added successfully to the Organization.
  • In case the customer belongs to a new organization that is not yet created, it will be automatically created by the rule using the reporter's domain as the organization name. Navigating to the Customers page from the above step can verify if the Organization has been created and the user added.
  • The customer-corresponding Organization will be added to the Organization field of the issue.


When using this automation rule as a workaround, please keep in mind that it doesn't allow domain combinations (e.g. .com and .com.au). The organization name must match the name of the email domain.

Please keep in mind, if you do not use the  Create organisation if it doesn't exist option, the rule will add users to Organizations they previously belonged to.

AUTO-1147 - Getting issue details... STATUS

Solution two

Similar to the above solution, however this solution adds users to a specific Organization that are configured in the rule itself. The use case here would be if an existing Organization's name is different to that of the user's email domain, the rule will add the user to the Organization. An example would be an Organization named ACME that customers with the email domain user@acmesolutions.com are added to, which Solution one would not work for. In this example, the ACME Organization will be id 1. To obtain your Organization's id you can go to Settings > Products > Organizations and select the the Organization from the list. The id will be in the URL as highlighted in the below screenshot:

This solution uses the Jira Service Management Cloud REST API, therefore ensure you have generated an API token that can be used by following the instructions on the article Manage API tokens for your Atlassian account.

  • Similarly, we will use the Issue created trigger with the automation rule
  • Configure a If condition to check:
    • If the reporter's email address matches the domain we would like to automatically add to the Organization

      Smart value with regex
      {{reporter.emailAddress.match("[a-zA-Z0-9_.+-]+@([a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+)")}}
    • The reporter is already a member of the Organization

  • Within the If condition, add a Send web request action, configuring it to use the Add users to organization REST API endpoint:
  • The Organization id gathered earlier can be added to the URI and the reporter's account id can be provided in the payload of the POST function


Last modified on Apr 16, 2024

Was this helpful?

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