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.
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
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).
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).
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.
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.
I hope this helps.
Best
Simon
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you much @Simon Schwab Mariño ! That totally worked!
Another employee here was annoyed by the duplicated emails and stumbled across my post here. Did not realize you had replied. I and every developer here thank you. 🙇
👏👏👏
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello, @Simon Schwab Mariño!
I could use your expertise here. I followed the setup steps above, but in the end I'm still seeing notifications being generated multiple times for the same user, even after they've received their 1st email notification when added to the field. Here is the current automation build. Would love any assistance that could be provided:
The behavior I'm seeing is as follows:
- Added John Williams as a Work Participant > John received an email
- Then added Christine Anna as a Work Participant > 2 emails were generated, both with John and Christine in the "to:" field
Any thoughts on how to avoid the multiple emails? I would like it to be set so that John only receives an email once he's added, and not again when other users like Christine are added.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Mike Vitale
Smart values are name, spacing, and case-sensitive. And when they do not match a known value, they evaluate to null and often silently fail to work as expected.
Your condition at the start of the branch is referencing {{Work Participants.accountId}} but that does not match your branch variable of {{workparticipants}} Is that what you intended to check?
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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:
This will not handle the case where someone is added, removed, and re-added.
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Joshua Wyss - Did you try to implement Bill's suggestion?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@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:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Great! Glad you are making progress.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.