Forums

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

Using a custom field value in the "TO" field to send an email via automation

Terry Reese September 27, 2022

I'm trying to setup and automation to allow individuals to note if a submitted ticket should be copied to other individuals within the organization (not necessarily the support team).  

I setup a custom field I call "Send Copy".  I've created an automation with the following critiera:

On Issue Create

* If Request Type = Service Request AND Send Copy is not empty

** Send Email

In the to field, I'm using: {{issue.[Send Copy]}}

I've also tried {{issue.[Send Copy].value}}

In both cases, I get the following error:

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

However, the field isn't empty, and the system must recognize that it's not empty, or the automation should attempt to run based on the If criteria.

I guess I'm wondering if I can use a custom field in the To field  of the email automation without utilizing a specialized plugin.

thanks,

 

--tr

2 answers

1 vote
Terry Reese September 28, 2022

Support was able to help me with this issue.  Essentially, the error being reported was the error that was occurring.  When I setup the field, I assumed I could use semicolons or commas between the email fields.  Only commas work (I default to semi-colons).  The error in the audit logs were saying the TO field was empty -- but what actually appears to be happening was that the email system wasn't able to parse the data.

Once I changed the data to comma space, it worked fine.  So, I've adjusted my automation to include a little data validation.

Thanks all,

 

--tr

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.
September 28, 2022

Ah, and thanks.  The missing part of the symptom was "when using multiple email address values in a custom field..."

I am glad to learn the support team was able to help. 

As a precaution, I suggest updating your rule to add replaceAll(";",", ") so it can handle someone entering semicolons in the field.

0 votes
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.
September 27, 2022

Hi @Terry Reese -- Welcome to the Atlassian Community!

That should work...what is the type of your field: text, user, etc.?

And, if you write that custom field to the audit log, what do you see?

One more thing to check...Smart values are name, spacing, and case-sensitive.  To confirm you have the correct smart value, please take at look at this how-to article to learn the supported smart values for rules: https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/

You may also use the custom field id if the name does not work.

Kind regards,
Bill

Terry Reese September 27, 2022

Thanks -- this is just a text field that I created in the custom field section.  I'm sure I got the spacing and info right because I sent an email directly to me and included the field data in the body and it was fine.  It's just in the TO field where it's not resolving.  

I'll see if I can find the ID and try using that.

--tr

Terry Reese September 27, 2022

So I did a quick test using the field id.  

In the To field -- I'm emailing directly to me and the custom field.  In the body I've included the following:

{{issue.description}}

{{issue.customfield_10095}}

 

In the email sent -- I get the data found in the body and the custom field.  If I use: 

{{issue.customfield_10095}} in the "TO" field -- it always errors and tells me that the field is empty.  

Not quite sure what I'm missing.

-tr

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.
September 27, 2022

Terry, is this rule/custom field in a team-managed or in a company-managed project?

If it is for team-managed, there is an open issue where custom fields cannot be used in the TO address for an automation email: https://codebarrel.atlassian.net/browse/AUT-131

Terry Reese September 27, 2022

Thanks -- this is a company managed project and in the automation scope, I've placed this automation to run in the project scope.

 

tr

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.
September 27, 2022

Well, that should work.  You appear to be the site admin for a paid Jira license, so I suggest submitting a ticket to Atlassian support here: https://support.atlassian.com/contact/#/

They may see something we are missing in their logging.  And when you hear a response, please post back here what you learn to benefit the community.  Thanks!

Terry Reese September 27, 2022

Thanks - I'll do that and report back when I get an answer.

--tr

Like Bill Sheboy likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events