I am trying to create an automation rule for a template I'm creating that automatically send users in a custom field an email.
When an issue is transitioned in my automation rule i select the the "Send Email" component. In the To: box I entered this code to generate the user's email addresses taken from the users in a custom user field called "Stakeholders".
{{issue.Stakeholders.emailAddress}}
I don't know why this doesn't generate the user's email addresses found within my user field called Stakeholders.
When I type in
{{issue.Stakeholders.displayName}} it works just fine so I know "Stakeholders" is being recognized.
Any ideas?
There is an open defect that team-managed project custom fields do not expose/return the email address (I am guessing through the API) to the smart values:
https://codebarrel.atlassian.net/browse/AUT-1830
It's a bug so this is unresolvable currently.
That ticket shows it was closed on 10/13/2021 as "Won't Do". Was this issue resolved by other means or are we just dead in the water? Because I'm having the same problem. We have an issue type with a custom people chooser field for "Manager". I want to CC the Manager on automation emails if the assignee doesn't get it completed after X number of days. So I need the email address of the Manager in that custom people chooser field.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you are still seeing the issue they probably didn't map the field.
I haven't tried this for team-managed projects: a work-around you can try if you have the accountId of the user in that field is to call the REST API from the rule to get their email address. Here are a couple of documentation links if you want to try that:
Doing this technique will probably add a few seconds (at least) per rule execution.
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 Christian - Welcome to the Atlassian Community!
Why type of field is the Stakeholders custom field?
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.
Not sure this will work, but might be worth a try. So I would think this would send an email to each person in the list.
{{#issue.Stakeholders}} ({{emailAddress}}) {{/}}
What I am not sure about is if there needs to be some type of separator between them.
OR if this functionality will even work in the TO field of an email for a multi-select field.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've tried something similar but user isn't the name of the custom field, "Stakeholders" is so doesn't seem to do anything.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
One other thing to note is that this is a Team Managed project and not a company managed project. Not sure if that makes a difference. In the TO: box for the create email action there are certain fields like Reporter and Assignee that when selected they do generate the email addresses. It's only when I try and target the users in a custom field that it doesn't work.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
John has you on the correct track, and I suggest a small adjustment to add semicolon delimiters, except for the last value in the list:
{{#issue.Stakeholders}} {{emailAddress}} {{^last}} ; {{/}} {{/}}
But first, have you confirmed that value is the correct smart value of your field name? You may check that with the information in this how-to article:
https://support.atlassian.com/jira-software-cloud/docs/find-the-smart-value-for-a-field/
Best regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the suggestion Bill, unfortunately it did not return their email addresses. I wonder if their is no smart value for the field when it's created within a team-managed project versus a company-managed project.
One way I confirmed that I labeled the field correctly was by testing it this way
{{issue.Stakeholders.displayName}} and that does return the display names of everyone with the "Stakeholders" field so I know I referencing it correctly.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Interesting... that is why I was suggesting that how-to article. Basically you find an example issue which has your data, look it up with the REST API...
https://<yourinstanceurl>/rest/api/2/issue/<issuekey>?expand=names
And then search for your data and field name. If it is present, the smart value probably will work.
UPDATE: oops, and sorry for the bad guidance, as there is an open defect that team-managed project custom fields do not expose/return the email address (I am guessing through the API) to the smart values:
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.
Ahhhhh ok, well at least I'm not crazy lol! Thank you for at least giving me some kind of resolution on the issue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I haven’t used stakeholders before. I went to the documentation for Smart values but I didn’t see stakeholders. I assume you have validated it? I see your last comment seems to indicate it’s valid but my question is does it actually produce results?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry "Stakeholders" is a custom multi user field I created. It's populated with a set number of users I would like to send emails to but I can't seem to figure out how to generate their email addresses. Other things seem to work just fine like displayName for example.
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.