Forums

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

ScriptRunner Listener: How get custom text field value into email template?

John Dorapalli May 3, 2018

Hi,

I am trying to get a custom text field value into the "Email template" of "Send a custom email" script listener.

I tried many options that includes the following:

$cfValues['Custom Field Name']

$event.issue.getCustomFieldValue('customfield_11111')

$issue.getCustomFieldValue(componentManager.getCustomFieldManager().getCustomFieldObjectByName("Custom Field Name"))

 

Email Template:

----------------------

Hello $event.issue.getCustomFieldValue('customfield_11111')

We have received your request for $issue.summary. 

The reference number for this request is $issue.

Regards,

--------------------------------

 

Thanks for your time and help.

--John

1 answer

1 accepted

5 votes
Answer accepted
Brittany Wispell
Community Champion
May 3, 2018

Hey @John Dorapalli 

It should be something like this. What type of custom field is it? 

$issue.getCustomFieldValue('customfield_####')

Brittany Wispell
Community Champion
May 3, 2018

Actually it's something like this. 

 

Custom message here: <% out <<issue.getCustomFieldValue(com.atlassian.jira.component.ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Custom Field Name")
) %>
Like Justin likes this
John Dorapalli May 3, 2018

Hi Brittany,

Thank you for your quick response.

I tried that and it is not working.

$issue.getCustomFieldValue('customfield_11420')

 

It is a simple text custom field.

 

--John

Brittany Wispell
Community Champion
May 3, 2018

Hey @John Dorapalli try the second one I posted. Sorry for the confusion. But the second one should definitely work, just replace the custom field name with the name of your custom field name.

John Dorapalli May 3, 2018
Bingo. The 2nd option works.
Thanks a lot @Brittany Wispell.

I remember trying that option but I tried it without the "out" statement.
Brittany Wispell
Community Champion
May 3, 2018

Awesome! Glad it worked! Have a great remainder of your day. :) If you could please accept this answer as a solution that would be greatly appreciated. It is the check mark next to the vote button :)

Suggest an answer

Log in or Sign up to answer