We use automation to send reminder emails (ITIL 3 strike rule) to customer/ticket reporter. The email message starts with "Hi Firstname". Below code does that for us.
{{issue.reporter.emailAddress.substring(0,1).toUpperCase()}}{{issue.reporter.emailAddress.substring(1, issue.reporter.emailAddress.indexOf("."))}}
Cheers,
Sami
You may use the capitalize() function, adding it to the end of the expression:
https://support.atlassian.com/cloud-automation/docs/jira-smart-values-text-fields/#capitalize--
Hi Bill,
Will this work with a custom field? We have a custom field named 'personal email,' which value in this an email address format firstname.lastname@domain.com and we are trying to split the first and last name from it to display in the email when it is sent automatically from the automate rule. However, I tried as below, and it doesn't seem to be working.
{{issue.personal email.emailAddress.split(".").get(0)}}
{{issue.personal email.split(".").first}}
Please advise.
Thank you.
Hi @Dee Minty
This technique works for text smart values. If your field is text, this may work:
{{issue.personal email.split(".").get(0)}}
If not, are you certain you have the correct smart value for your field?
Smart values are name, spacing, and case-sensitive, and do not always exactly match the displayed field name on the issue views. To confirm you have the correct one, you may use the how-to article below. The essential steps are:
yourJiraURL/rest/api/2/issue/yourIssueKey?expand=names
https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/
Kind regards,
Bill
Hi @Bill Sheboy
Thank you for your reply, I found the custom field id and use it as in the capture screen below, but it still cannot show first & last name from the email address in the email.
Not sure what did I do wrong.
Please advise
Thank you.
Best Regards,
Let's try this: write just that custom field to the audit log to confirm what it contains:
{{issue.customfield_10132}}
Once we know that we can adjust the smart value expression.
Hi Bill,
I’ve tried using {{issue.customfield_10132}} and {{issue.Personal Email.split(" ").get(0)}}. Both work, but the entire email address is still displayed in the email.
Do you have any suggestions?
Thank you.
Is your split(" ") as you just posted, or with the period in the email address: split(".")?
Please post images of your complete rule and of the audit log details showing the rule execution. Those may provide context to help explain what you are observing.
Hi Bill,
Our email addresses use a period to separate the first and last name (e.g., john.wick@a.com). However, as shown in the picture below, the first two examples display the entire email address correctly. The last one, highlighted in grey with a period (".") shows nothing.
Thank you.
Best Regards,
Solving problems with automation often requires understanding the context of the rule actions. Please answer / post the following to clarify the rule context:
(1) What version of Jira are you using: Jira Cloud, Server, or Data Center?
(2) If using Jira Cloud, what type of project is this: team-managed or company-managed? You may find that information at the bottom-left side of the page expanding area, or by looking at the type in the list of "View All Projects".
(3) What is the type of your custom field: text, user selection, something else?
(4) Please post an image of your complete automation rule.
(5) Please post an image of your audit log details showing the rule execution.
Thank you.
Hi Bill,
Version: I'm not sure about the version but this is an ITSM
Project type : Service management
Field: It's a custom text field
I'd like to show only John Wick in the email.
I hope I provide the right information.
Thank you.
Best Regards,
I notice your rule uses the Issue Created trigger. That trigger can fire so quickly that the issue data is not yet available to the rest of the rule step. This can cause problems, such as apparently empty fields.
I recommend adding the Re-fetch Issue action immediately after the trigger. That will slow down the rule a bit, reloading the data before it proceeds.
Your email body references the smart value {{Employee First Name}}. Where does that come from?
Next, as you identified the correct custom field id, customfield_10132, let's stick with that rather than alternating with the field name, Personal Email.
Using the Log rule action to write to the audit log, please write each of the following with a separate action for each, and describe what you observe when testing the rule with your example email address in the field, john.wick@a.com:
only the field: {{issue.customfield_10132}}
splitting the field: {{issue.customfield_10132.split(".")}}
number of items split from the field: {{issue.customfield_10132.split(".").size|0}}
first name from split field: {{issue.customfield_10132.split(".").get(0)}}
What you should expect to see in the audit log is:
If you do not see those please recheck that the smart values are correct.
Hi Bill,
I'd like to give you an update that my issue can be fixed by
{{issue.customfield_10132.substringBefore(".").capitalize()}} that @Sami Ullah used.
Thank you so much for your help.
Best Regards,