Inside the HTML Template of Emai This Issue, how can a substring within $!issue.assignee.displayName be obtained and then displayed?"
(Example: $!issue.assignee.displayName = "Sample, Joe")
How could I obtain the substring "Joe"?
How could I obtain the substring "Sample"?
How could I display the 2 substrings as "Joe Sample"?
I know there are substring function in jql but I don't know if those things are available in Email This Issue.
Hi Jonathan,
If using an automation rule/smart values, you can do this:
{{issue.assignee.displayName.split(" ").first}}
Hey @Elston, Jonathan ,
Welcome to the community!
VTL can use a lot of string functions, including the one you need.
The trick is to always to calculations within a new variable, otherwise it won't work.
I wrote it out in different steps for you:
#set ($myString = "$!issue.assignee.displayName")
#set ($myArray = $myString.split(" "))
#set($length=$myArray.size())
#set($last = $length - 1)
$myArray[$last]
You need to follow these steps:
Hope this helps!
- Tessa
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks. I'll try it out. Would the following work if currentUser.displayName = lastName, firstName?
#set ($displayName = “$!currentUser.displayName”)
#set ($myArray = $displayName.split(“,”))
$myArray[1] $myArray[0]
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Looks good, it should work. But test it out just in case and let me know if the result is not what you expect.
I'm not sure currentUser works in this context, so I would be happy if you let me know, so we can learn from each other!
If this answer helped you, please accept it so others can find the solution to a similar question faster.
- Tessa
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.