Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Smart Values in Automation email address

Matt S
Contributor
August 9, 2021

I'm trying to come up with a method for delivering notification emails to new users prior to their creation as users in Jira. These users do have functional email addresses. Using automation, I have a Send Email action configured with smart values in the recipient field. This does not seem to be working and I'm curious if smart values can be used here. If not, how could an email address be constructed out of values in multiple custom fields?

JiraSmartValueEmail.png

3 answers

0 votes
John Funk
Community Champion
July 13, 2022

Hey @Matt S  - Did you ever get this working? 

0 votes
Fabian Lim
Community Champion
August 9, 2021

Hi @Matt S

Give this new feature a try that allows you to create variables. Link: https://community.atlassian.com/t5/Jira-articles/Automation-for-Jira-Create-variable-New-component/ba-p/1448118

You can create a variable that constructs the email and use it in your send email action.

Let us know if this works.

Matt S
Contributor
August 9, 2021

Hi @Fabian Lim 

That action would definitely solve this problem, but unfortunately we're using Jira Server and it only appears available on Cloud.

Like # people like this
0 votes
Liam Green
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.
August 9, 2021

Hi @Matt S 

I'm curious as to why you wouldn't add them as users straight away?

Matt S
Contributor
August 9, 2021

Hi @Liam Green 

We use Devinti Active Directory Attributes Sync to pull new users from AD, but the sync only runs once per day. I'm going to attempt running the notification automation on a schedule to see if waiting until this sync occurs will fix the issue.

Liam Green
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.
August 10, 2021

Hi @Matt S 

That makes sense.

If you want to, you could store the email address you need in a custom field and put the email address as {{issue.customfield.FIELDNAME}}

Matt S
Contributor
August 11, 2021

That is a viable alternative, I appreciate the suggestion. Setting those automations to run on schedules has solved the problem. 

Mykenna Cepek
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.
January 30, 2024

I was struggling with this today also, and @Liam Green's solution worked for me. However, I was able to improve upon it. More below.

Note that an assumption here is that you need a "current issue" in the rule to work with. In my case, this was a manually triggered rule.

We're using Jira Data Center, and I wanted to put "{{initiator}}@ourCorp.com" into the "To" field of the "Send email" action. Just doing that didn't work.

Initially, no email seemed to be sent. As a test, I added a second, hardcoded email address in the "To" field. Then an email did get sent and I could see the Smart Value as an intended recipient (which of course failed to send during email processing):


initiator.png


A workaround (as Liam outlined) is instead to:

  • Construct the email into a text field on the issue. So use "Edit issue" to set some available text field in the issue to the desired email -- in my case:  {{initiator}}@ourCorp.com
  • Use the "Re-fetch issue data" action. The "No delay" setting worked fine in my testing.
  • Then the "Send email" action can use the custom field in the "To" field as a Smart Value.

When configuring the "Send email" action, Jira automation seems to recognize a stand-alone Smart Value (which is shown in a different color) from a plain email address (even if that includes a Smart Value, as my first attempt did). Probably just some lazy matching failing to find the }} at the end, and then assuming it's a real email.

ALTERNATIVES:

In Jira Cloud, use a Variable in the rule instead of all this goofing around.

In Jira Server and Data Center, an Entity Property can often be used instead of a Variable. I refactored my solution above, and was able to eliminate the Re-fetch action and avoid injecting noise into the fields of the issue itself:


issueProp1.png


issueProp2.png

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events