Automation content help
Asked by Kate Stewart:

Hi!

<br />

I'm trying to create a few automations that include sending an email that contain the data i have in a custom field. Each custom field is a "short text (plain text only)" and has been added to the correct screens.

I'd like to add the custom field into both the subject line and within the content of the email.

The custom field is a "i'm putting into the email is "Employee's Legal Name" and "Last Day On Payroll (Term Date)". When i receive the email, the content isn't populating my custom field data. I have tested MULTIPLE different ways of entering the content but they all fail.

i've tried:

1. {{issue.Employee's Legal Name}}

2. {{issue.Employee's Legal Name.value}}

3. {{issue.customfield_10355}}

and many more.

How can i get my custom fields to populate in an email, slack message, jira comment or ANY thing else i want to add as content in my automations?


Answers:
author: Christian
body: Hello Kate

This is a bit peculiar, as your syntax looks correct and I would be expecting the proper values to populate. I have two theories as to what could be going on.

1. There is a space at the end of your custom field

Sometimes a rogue " " is added to the end of your custom field, making it harder to reference. Check under "custom fields" in your application admin settings. I don't think this is likely, as you are still having the problem even when referencing the field ID. This leads to what I think is more likely the issue.

2. Your Automation is triggering against different issue than you expect

This all depends on how the automation is triggering, but sometimes in our automations we put in a for branch that references other issue. We then trigger actions in the branch which actually action against the looping issues, rather than the trigger issue. If these looped issues do not have any value for "Employee's Legal Name" they will return as blank. You can look at the audit log to see which issues are being actioned and that may point you in the right direction as to what is happening.

These are both just guesses and the actual problem could be something completely different. Let me know if either of these help or if you need other ideas.

Best,

Christian

comments: author: Kate Stewart
body: Thanks Christian.

Here is my trigger![Screenshot 2024-05-31 at 12.20.33?PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/327270i42849DB7AE4EB120/image-size/large?v=v2&px=999 "Screenshot 2024-05-31 at 12.20.33?PM.png")

I'm not using a branch component.


author: Christian
body: Okay, that is good to know.

See this, the automation is triggered on issue created, there can really be only two reasons the content isn't populating:

1. The custom field is being referenced incorrectly

2. There is no data in the custom field to be referenced.


author: Christian
body: Sorry, my answer submitted without me completing it. I wanted to add that perhaps you have two fields with the same or very similar names. One is on the create issue screen that you are filling, and the other is one that you are referencing in the automation.   

I can't troubleshoot any further on my end. Best of luck to you in figuring this out!

Christian


author: Kate Stewart
body: thanks Christian. Maybe i'll figure it out on the back end. In the meantime, what is the best syntax to use?


author: Christian
body: Either number 1 or 3 will work. I would use number one, as if myself or someone else is referencing the automation in the future it will be easier to tell what it is doing.


Tags: cloud

jira-service-management

jira-service-management-cloud