custom email post function

Sergio Palacio March 15, 2018

I'm using scriptrunner.


I trying to add custom field value in the post funcion send email but I receive an error mesage.

look at my code.

 

<p> Issue ${issue.key} was created
<p> Created by: ${issue.reporter}
<p>
Custom field value: <% out << issue.getCustomFieldValue(componentManager.getCustomFieldManager()?.getCustomFieldObjectByName("Epic Link")) %>
<p>
<p>
$Description {issue.description}

 

Error

No such property: componentManager for class: groovy.lang.Binding

 
thanks!

2 answers

1 accepted

0 votes
Answer accepted
Brittany Wispell
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 15, 2018

Hey @Sergio Palacio

Try this...

Custom Field Value: <% out <<
issue.getCustomFieldValue(com.atlassian.jira.component.ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Epic")) %> <br>
Brittany Wispell
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 15, 2018

I would also recommend using breaks instead of paragraphs.

<br> 

Sergio Palacio March 15, 2018

Hi brittany. thanks for your suggestion  I tried.

Now  the error is 

Error

undefined

Brittany Wispell
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 15, 2018
Custom Field Value: <% out <<
issue.getCustomFieldValue(com.atlassian.jira.component.ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Epic Link")) %> <br>

Did you change the Custom Field Value to "Epic Link". I forgot to change it to Epic Link in my first reply. 

Sergio Palacio March 15, 2018

Error

No such property: Description for class: groovy.lang.Binding

Brittany Wispell
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 15, 2018

Replace your Description with the below.

Description: $issue.description<br><br>
Brittany Wispell
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 15, 2018

Here's the whole email script...

 

${issue.assignee?.displayName} --This is how you get the assignee and the full name if needed.

${issue.reporter?.displayName} --This displays the reporter as a full name.

<a href="$baseUrl/browse/$issue.key">${issue.key}</a> --This will provide a link to the issue within the email sent.

Description: $issue.description --This is how you get the description.

Custom Field Value <% out <<
issue.getCustomFieldValue(
com.atlassian.jira.component.ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Epic Link")
)%> <br> --This is how you get a custom field.

Like # people like this
Sergio Palacio March 15, 2018

thanks for your help. It is now working ok!!!
:)

Brittany Wispell
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 15, 2018

Awesome! Glad I was able to help! 

Have a great week!

0 votes
Gurpreet Sandhu July 16, 2019

Hello,

 

I have a similar issue where I want to send an email to a specific user using a Script runner where Issue Reporter is a specific person and Issue Type = Bug or Issues. Please advice.

 

Thank you,

Guru

Suggest an answer

Log in or Sign up to answer