Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,556,311
Community Members
 
Community Events
184
Community Groups

How to populate a custom field based on the email domain of the reporter

Sometimes, it is necessary to use the department or location the user belongs to in JQL filters. Natively this option is not available in Jira even if this value is present in the user's profile.

The details like Department, job title, organization etc, that are shown on an Atlassian account's profile or that are synced from the IDP are not available to be used as a field in Jira. There is a feature request suggesting the implementation of this ability:

The option presented below could be a workaround which would be useful to populate a custom field based on the subdomain present in the user's email.

The following are pre-requisites for this to be a success: 

  1. The rule would only work if the users had subdomains in the email address
  2. Automation service limits would have to be respected so there needs to be a limit to the number of subdomains that are checked.
The smart value to get the domain part of the email address is "reporter.emailaddress.split("@").last"

As shown below, I was able to get a custom field called 'Dept' populated with the value based on the reporter domain. Here, the custom field Dept was of type Text field. 

  • Trigger: Field value changed.
    • Fields to monitor for changes: Reporter;
    • Change type - any changes to the field value.
    • For - All issue operations.
    • image.png
  • Action: Create variable 
    • Variable Name - Domain, Smart value - 
      {{reporter.emailaddress.split("@").last}}
    • image.png
  • If/else block - use advanced compare conditions 
    • Domain equals <atlassian.com>
    • image.png
    • Edit Issue fields - set Dept value Location 1
    • image.png
    • First value - Domain equals <gmail.com>
    • image.png
    • Edit Issue fields - set Dept value Location 2
    • image.png

 

The rule runs when a new issue is created or when the reporter field changes and the field Dept is not populated with a value as shown below:

image.png

We can now use the field Dept in a JQL query - for example to get a list of tickets created where the Dept is set to Location 2 as seen below:

image.png

Note - 1:

The trigger used in my example above is Field Value changed. As per the documentation, this includes any changes to the field value (Value added, value deleted or any changes to the field value) due to any of the actions as highlighted in the screenshot below.

automation-trigger.png

So the value of the reporter changing/being set when the ticket is created would also be included in this trigger.

Note - 2:

If there are many if/else clauses to check, a lookup table could also be created for this purpose, thus also simplifying the automation rule, but that is out of scope of this article :) 

Including the documentation for that below:

References:

1 comment

Curt Holley
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 03, 2023

I like it and have done almost the same thing. Only difference, my variable is {{issue.Reporter.emailAddress}} and my If/Else conditions are, If {{email}} (variable name) contains @domain.name Then populate Dept field with appropriate entry. 

Like Bhaargavi Natarajan likes this

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events