Forums

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

Creating a custom email using Scriptrunner

Norm Moore
Contributor
October 12, 2022

Hi,

I'm working on creating a custom email that "partially" works. I've managed to get the condition working properly but I'm hitting a problem with the email template format. There are a few key things that I need but I'm unable to figure out the exact issue and would love to see if anyone can assist me.

Current email template, what I need to make this complete is to grab the assignee and the issue number. I don't know exactly how to code that in groovy.

Hi [~${issue.assignee?.key}],
As per ASPICE guidelines, ticket component must be updated with the correct SW architecture component. Update the component field in the Jira ticket asap.

<Issue number placeholder>
----------
Thank you for your help!
Norm

1 answer

1 accepted

0 votes
Answer accepted
Ram Kumar Aravindakshan _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 13, 2022

Hi @Norm Moore

Could you please specify what you are using the create the Custom Email?

Is it via Listener or Post-Function? Is it the Send a custom mail post-function or Custom script post-function, or a Custom Listener?

Thank you and Kind regards,

Ram

Norm Moore
Contributor
October 13, 2022

Hi @Ram Kumar Aravindakshan _Adaptavist_ 

I'm using Send a custom email via Post Function. 

Ram Kumar Aravindakshan _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 14, 2022

Hi @Norm Moore

For your requirement, you could try something like this for the Email Template in the Send a custom mail Post-Function:-

 

Hello ${issue.assignee.displayName}<br/><br/>

This is a test message

Please note that the sample above is not 100% exact to your environment. Hence, you will need to make the required modifications.

Below is a screenshot of the configuration:-

config1.png

Below are a few test screenshots for your reference:-

1. The issue is currently assigned to the user Admin

issue_sample.png

2. When the issue transitions to In Progress, the email is sent out and below is the result displayed in the email.

email_output.png

I hope this helps to solve your question. :-)

 

Thank you and Kind regards,

Ram

Norm Moore
Contributor
October 14, 2022

Thank you Ram...one last question,

Where I placed <Issue number placeholder> is there a script that will fetch the issue number of the ticket? Similar to what you've put forward to fetch the assignee?

Ram Kumar Aravindakshan _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 15, 2022

Hi @Norm Moore

What do you want to display in the issue number placeholder? Is it the issue key?

If it is the issue key, you can try something like:-

Hello ${issue.assignee.displayName},

This is a test message

${issue.key}

Below is a screenshot for your reference:-

image2.png

I hope this helps to answer your question. :-)

Thank you and Kind regards,

Ram

Norm Moore
Contributor
October 17, 2022

Thanks Ram - it looks good appreciate the assistance.

Suggest an answer

Log in or Sign up to answer