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,558,907
Community Members
 
Community Events
184
Community Groups

Jira Automations Send email to new/changed person in user picker field fieldChange

Edited

I want to be able to use Jira Automations to send an email to the new person in a user picker field (Assignee, custom, etc.) and not all people. I want this to trigger on 2 different user picker fields so I want to use the {{fieldChange}} smart value but it does not provide the email address.

 

Scenario 1

For example, when a new person is assigned to a Jira Issue I want to trigger and send only that new person an email.

Scenario 2

When a new person is added to a multi-person person selector custom field I want to trigger and only send an email to that new person and not others.

 

I have tried

In the 'Send an email" action I've tried adding the following to the "To:" field but none have succeeded.

  • {{#fieldChange}}{{emailAddress}}{{/}}
  • {{fieldChange}}
  • {{fieldChange.to}}
  • {{#fieldChange}}{{emailAddress}}{{/}}
  • {{addedfieldChange.values}}

The Error:

Send Email:

Could not send email, the 'To' address field is empty. If you have referenced a field it may be empty.

The same error happens for all options.

Related questions:
https://community.atlassian.com/t5/Jira-Software-questions/How-can-I-get-email-address-from-changed-field/qaq-p/1484803

https://community.atlassian.com/t5/Jira-questions/Jira-Automation-How-to-send-mail-only-to-added-User/qaq-p/1443188

2 answers

Hey @Joshua Wyss

We also wanted to perform specific actions for newly added users only, ignoring the existing users in a user picker field. 

Here is the approach I went with (in this scenario the user picker field is "Approvers"). It's very close to @Bill Sheboy proposal but without the need of using a comment/additional custom field. It also works for "adding, removing, and re-adding" scenarios and you can monitor as many fields as you like with a single automation, removing the need to maintain the same email template in multiple locations.

As Bill pointed out as well, the {{fieldChange}} behaviour seems to be broken atm (or the documentation is ambiguous). You might want to revise the automation once that's fixed/changed.

1. Set a trigger to trigger on added values only (naturally, the Edit issue constraint is optional).

2023-02-16 19_23_50-Automation - Jira.png

2. Use advanced branching to execute the branch for each value in <user_picker_field> and assign the individual values to an "iterator variable" of your choice (here it's approver).

2023-02-16 19_25_21-Automation - Jira.png

3. Use the advanced compare condition to check if the {{fieldChange.from}} value (which appears to be a string with all existing account IDs) does not contain the respective user's account ID (here {{approver.accountId}}). Because if it doesn't, that means it was added just now.

2023-02-16 19_27_11-Automation - Jira.png

4. Use your variable containing the user object (in this example it's {{approver}}) to access the user property you need for any action you might want. To match your use case, I sent an email to the newly added users, as shown in the full depiction below.

2023-02-16 19_22_01-Automation - Jira.png

I hope this helps.

 

Best
Simon

Serena Romeo
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
Mar 30, 2023

Hi Simon, 

I tried your method and it is working, but I noticed that If I add two ore more users in my user picker field, in the email's "to" I only see myself and not the others users email addresses.

Do you happen to know a way around this?

Thank you,
Serena

Hey Serena

To clarify: I assume you're testing the automation by adding yourself and others to the user picker field. In the consequently received email, you only see yourself as a recipient, and you're now wondering if it's possible to have all recipients visible in that email's "to" field. Is that correct?

If that's the case, you're experiencing the "desired" behavior. The automation executes the For each: Smart value branch for every new user. Thus, it sends one email per added user instead of one email to all users, which, I guess, is what you want.

Unfortunately, I wouldn't know how to achieve this with the limited operations available in Jira Automation or smart values.

Best
Simon

Like Serena Romeo likes this
Serena Romeo
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
Mar 30, 2023

Thank you Simon, you explained it way better than I did! :)

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Mar 30, 2023

Hi @Serena Romeo -- Welcome to the Atlassian Community!

You could try using the field change smart value which seems made to do this:

{{addedfieldChange.values}}

Please look here for more information: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-issues/#--fieldChange--

Kind regards,
Bill

Like # people like this
0 votes
John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Nov 16, 2022

Hi Joshua,

I don't have time to fully investigate right now, but here's some thoughts. 

1. You should be able to do this now. Just make your trigger as a Field Value change to Assignee and send the mail to the Assignee. 

2. I am thinking that you could use the #lookupIssues function in some way to get the account ID of the person added. Then dump that into a custom user picker field (hidden from the screen). And then send an email to that custom field. 

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Nov 16, 2022 • edited

Hi @Joshua Wyss 

Yes, and...to John's answers...

For your second case, you are encountering the problem where changelog seems not to be working lately with smart values for multi-select and multi-value fields (user-picker, fixVersion, labels, etc.)  Until that is fixed (added?) work-arounds are messy.

One approach is to capture values (i.e. flag) in another custom field/comment once an email is sent:

  • iterate over the values in the custom field using an advanced branch
    • check with an if condition for the absence of the value in the other custom field/comment
    • send your email using the branch iterator variable to get the email address
    • add the flag value to the custom field/comment

This will not handle the case where someone is added, removed, and re-added.

Kind regards,
Bill

@John Funk I did the route you suggested in #1 where I cloned the automation with one triggered by Assignee and the other triggered by my customer user field.

This isn't the most efficient way to build this because now I maintain the same email content in two automations.

I looked into your suggestion #2 but did not understand how it would be implemented.

 

My goal was to put multiple user fields in the same trigger and access the email address of whoever triggered the Automation. I think this is just a missing feature as @Bill Sheboy suggested.

John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Feb 17, 2023

@Joshua Wyss  - Did you try to implement Bill's suggestion? 

@John Funk no I have not done either suggestion. I put this aside since I got it working at the minimal level. I am contacting a couple of users to see if they get copied when others are added, and if they do I'll implement @Bill Sheboy 's suggested solution. Either way I'll reply with what I learn.

Here is what I currently have:

2023-02-28 14_42_17-Clipboard.png

Like John Funk likes this
John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Feb 28, 2023

Great! Glad you are making progress. 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events