How do I get the value of a JIRA custom field and use it in the body of a Groovy HTML template?

Hi,

I want to create an email template using the JMWE addon's Email Issue feature. I want to get the value of a custom field, multiple select - single choice, and display that value in the Groovy email HTML template body.

I understand how to access the JIRA issue fields, but I do not understand how to insert a custom fields value into the email body.

My Groovy HTML template body is below

Hi,
An urgent Change Management request has been submitted by <%=issue.reporter %> on behalf of get(<field_12471>)

Regards,
<i>$currentUser.displayName</i>

 What should I use to get the value of the "CPM - What Line of Business does this change relate to?" custom field so it will display correctly in the JMWE Test Groovy Template and in the email sent to selected users.

Thank you in advance for your help.

Joe

 

1 answer

0 votes

You simply do:

<%= issue.get(“CPM - What Line of Business does this change relate to?”) %>

Hi David,

Thank you for the prompt reply. I inserted your suggestion in both the HTML and Text Body of the email and it shows this.

Your script ran successfully

Result type:
String
Result value:
Hi,
An urgent Change Management request has been submitted by  pursej(pursej) on behalf of %= issue.get(“CPM - What Line of Business does this change relate to?”) %> and approved by   Change Management will review the request as soon as possible. The requestor will be contacted within 2 business hours (PST) and should be prepared to engage with Change Management immediately and provide drafts of Seller- and Associate-facing content as well as Seller impact information.
 
Regards,
<i>Joseph Pursel</i>

 Either way, it repeats the issue.get as coded in the request. Am I missing something?

Thank you,

Joe

Hi David,

I have additional information as the atlassian-jira-outgoing-mail.log has repetitive ERRORS for the Email function of JMWE. In addition, although the email was sent and received, yet the Mail Queue shows the Email, in pink, as it continues to not be closed and ultimately goes to the Error Queue.

Attached for you are the ERROR as shown in the outgoing mail log as well as the content of my post function. Please help me understand why this ERROR is created and why it is not properly closed in the outgoing mail queue.

Thank you,

Joe

JMWE Email Error's in the Mail Queue Error Tab.PNG

 2017-10-05 00:33:01,462 ERROR [] Sending mailitem To='janbro@amazon.com,tam-hotdesk-emergency@amazon.com,jkolby@amazon.com,stievano@amazon.com,lipscomb@amazon.com,bthornell@amazon.com,marien@amazon.co.jp,page-cpm-jp@amazon.com' Subject='Change Management 911: JTCP-127' From='janbro@amazon.com' FromName='Jane Brooks' Cc='' Bcc='' ReplyTo='null' InReplyTo='null' MimeType='text/plain' Encoding='UTF-8' Multipart='javax.mail.internet.MimeMultipart@2a1c6ea8' MessageId='null' ExcludeSubjectPrefix=false' anonymous    Mail Queue Service Error occurred in sending e-mail: To='janbro@amazon.com,tam-hotdesk-emergency@amazon.com,jkolby@amazon.com,stievano@amazon.com,lipscomb@amazon.com,bthornell@amazon.com,marien@amazon.co.jp,page-cpm-jp@amazon.com' Subject='Change Management 911: JTCP-127' From='janbro@amazon.com' FromName='Jane Brooks' Cc='' Bcc='' ReplyTo='null' InReplyTo='null' MimeType='text/plain' Encoding='UTF-8' Multipart='javax.mail.internet.MimeMultipart@2a1c6ea8' MessageId='null' ExcludeSubjectPrefix=false'
com.atlassian.mail.MailException: com.sun.mail.smtp.SMTPSendFailedException: 554 Message rejected: Email address is not verified. The following identities failed the check in region US-EAST-1: janbro@amazon.com, Jane Brooks <janbro@amazon.com>
    
    at com.atlassian.mail.server.impl.SMTPMailServerImpl.sendWithMessageId(SMTPMailServerImpl.java:225) [atlassian-mail-2.7.18.jar:?]
    at com.atlassian.mail.queue.SingleMailQueueItem.send(SingleMailQueueItem.java:44) [atlassian-mail-2.7.18.jar:?]
    at com.atlassian.mail.queue.MailQueueImpl.sendBufferUnderLock(MailQueueImpl.java:103) [atlassian-mail-2.7.18.jar:?]
    at com.atlassian.mail.queue.MailQueueImpl.sendBuffer(MailQueueImpl.java:56) [atlassian-mail-2.7.18.jar:?]
    at com.atlassian.jira.mail.JiraMailQueue$1.apply(JiraMailQueue.java:51) [classes/:?]
    at com.atlassian.jira.mail.JiraMailQueue$1.apply(JiraMailQueue.java:48) [classes/:?]
    at com.atlassian.jira.util.velocity.DefaultVelocityRequestContextFactory.runWithStaticBaseUrl(DefaultVelocityRequestContextFactory.java:110) [classes/:?]
    at com.atlassian.jira.util.DefaultBaseUrl.runWithStaticBaseUrl(DefaultBaseUrl.java:50) [classes/:?]
    at com.atlassian.jira.mail.JiraMailQueue.sendBuffer(JiraMailQueue.java:48) [classes/:?]
    at com.atlassian.jira.service.services.mail.MailQueueService.run(MailQueueService.java:21) [classes/:?]
    at com.atlassian.jira.service.JiraServiceContainerImpl.run(JiraServiceContainerImpl.java:61) [classes/:?]
    at com.atlassian.jira.service.ServiceRunner.runService(ServiceRunner.java:62) [classes/:?]
    at com.atlassian.jira.service.ServiceRunner.runServiceId(ServiceRunner.java:44) [classes/:?]
    at com.atlassian.jira.service.ServiceRunner.runJob(ServiceRunner.java:32) [classes/:?]
    at com.atlassian.scheduler.core.JobLauncher.runJob(JobLauncher.java:153) [atlassian-scheduler-core-1.7.0.jar:?]
    at com.atlassian.scheduler.core.JobLauncher.launchAndBuildResponse(JobLauncher.java:118) [atlassian-scheduler-core-1.7.0.jar:?]
    at com.atlassian.scheduler.core.JobLauncher.launch(JobLauncher.java:97) [atlassian-scheduler-core-1.7.0.jar:?]
    at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.launchJob(CaesiumSchedulerService.java:443) [atlassian-scheduler-caesium-1.3.3.jar:?]
    at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeLocalJob(CaesiumSchedulerService.java:410) [atlassian-scheduler-caesium-1.3.3.jar:?]
    at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeQueuedJob(CaesiumSchedulerService.java:388) [atlassian-scheduler-caesium-1.3.3.jar:?]
    at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService$1.consume(CaesiumSchedulerService.java:285) [atlassian-scheduler-caesium-1.3.3.jar:?]
    at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService$1.consume(CaesiumSchedulerService.java:282) [atlassian-scheduler-caesium-1.3.3.jar:?]
    at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.executeJob(SchedulerQueueWorker.java:65) [atlassian-scheduler-caesium-1.3.3.jar:?]
    at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.executeNextJob(SchedulerQueueWorker.java:59) [atlassian-scheduler-caesium-1.3.3.jar:?]
    at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.run(SchedulerQueueWorker.java:34) [atlassian-scheduler-caesium-1.3.3.jar:?]
    at java.lang.Thread.run(Thread.java:745) [?:1.8.0_102]
Caused by: com.sun.mail.smtp.SMTPSendFailedException: 554 Message rejected: Email address is not verified. The following identities failed the check in region US-EAST-1: janbro@amazon.com, Jane Brooks <janbro@amazon.com>
    
    at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:2267) [javax.mail-1.5.6.jar:1.5.6]
    at com.sun.mail.smtp.SMTPTransport.finishData(SMTPTransport.java:2045) [javax.mail-1.5.6.jar:1.5.6]
    at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1260) [javax.mail-1.5.6.jar:1.5.6]
    at com.atlassian.mail.server.impl.SMTPMailServerImpl.sendMimeMessage(SMTPMailServerImpl.java:245) [atlassian-mail-2.7.18.jar:?]
    at com.atlassian.mail.server.managers.EventAwareSMTPMailServer.sendMimeMessage(EventAwareSMTPMailServer.java:25) [classes/:?]
    at com.atlassian.mail.server.impl.SMTPMailServerImpl.sendWithMessageId(SMTPMailServerImpl.java:187) [atlassian-mail-2.7.18.jar:?]
    ... 25 more
2017-10-05 00:33:01,831 ERROR [] Sending mailitem To='janbro@amazon.com,pursej@amazon.com' Subject='Change Management 911 testing weds evening - testing JP' From='janbro@amazon.com' FromName='Jane Brooks' Cc='' Bcc='' ReplyTo='null' InReplyTo='null' MimeType='text/plain' Encoding='UTF-8' Multipart='javax.mail.internet.MimeMultipart@7a2e6130' MessageId='null' ExcludeSubjectPrefix=false' anonymous    Mail Queue Service Error occurred in sending e-mail: To='janbro@amazon.com,pursej@amazon.com' Subject='Change Management 911 testing weds evening - testing JP' From='janbro@amazon.com' FromName='Jane Brooks' Cc='' Bcc='' ReplyTo='null' InReplyTo='null' MimeType='text/plain' Encoding='UTF-8' Multipart='javax.mail.internet.MimeMultipart@7a2e6130' MessageId='null' ExcludeSubjectPrefix=false'
com.atlassian.mail.MailException: com.sun.mail.smtp.SMTPSendFailedException: 554 Message rejected: Email address is not verified. The following identities failed the check in region US-EAST-1: janbro@amazon.com, Jane Brooks <janbro@amazon.com>
    
    at com.atlassian.mail.server.impl.SMTPMailServerImpl.sendWithMessageId(SMTPMailServerImpl.java:225) [atlassian-mail-2.7.18.jar:?]
    at com.atlassian.mail.queue.SingleMailQueueItem.send(SingleMailQueueItem.java:44) [atlassian-mail-2.7.18.jar:?]
    at com.atlassian.mail.queue.MailQueueImpl.sendBufferUnderLock(MailQueueImpl.java:103) [atlassian-mail-2.7.18.jar:?]
    at com.atlassian.mail.queue.MailQueueImpl.sendBuffer(MailQueueImpl.java:56) [atlassian-mail-2.7.18.jar:?]
    at com.atlassian.jira.mail.JiraMailQueue$1.apply(JiraMailQueue.java:51) [classes/:?]
    at com.atlassian.jira.mail.JiraMailQueue$1.apply(JiraMailQueue.java:48) [classes/:?]
    at com.atlassian.jira.util.velocity.DefaultVelocityRequestContextFactory.runWithStaticBaseUrl(DefaultVelocityRequestContextFactory.java:110) [classes/:?]
    at com.atlassian.jira.util.DefaultBaseUrl.runWithStaticBaseUrl(DefaultBaseUrl.java:50) [classes/:?]
    at com.atlassian.jira.mail.JiraMailQueue.sendBuffer(JiraMailQueue.java:48) [classes/:?]
    at com.atlassian.jira.service.services.mail.MailQueueService.run(MailQueueService.java:21) [classes/:?]
    at com.atlassian.jira.service.JiraServiceContainerImpl.run(JiraServiceContainerImpl.java:61) [classes/:?]
    at com.atlassian.jira.service.ServiceRunner.runService(ServiceRunner.java:62) [classes/:?]
    at com.atlassian.jira.service.ServiceRunner.runServiceId(ServiceRunner.java:44) [classes/:?]
    at com.atlassian.jira.service.ServiceRunner.runJob(ServiceRunner.java:32) [classes/:?]
    at com.atlassian.scheduler.core.JobLauncher.runJob(JobLauncher.java:153) [atlassian-scheduler-core-1.7.0.jar:?]
    at com.atlassian.scheduler.core.JobLauncher.launchAndBuildResponse(JobLauncher.java:118) [atlassian-scheduler-core-1.7.0.jar:?]
    at com.atlassian.scheduler.core.JobLauncher.launch(JobLauncher.java:97) [atlassian-scheduler-core-1.7.0.jar:?]
    at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.launchJob(CaesiumSchedulerService.java:443) [atlassian-scheduler-caesium-1.3.3.jar:?]
    at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeLocalJob(CaesiumSchedulerService.java:410) [atlassian-scheduler-caesium-1.3.3.jar:?]
    at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeQueuedJob(CaesiumSchedulerService.java:388) [atlassian-scheduler-caesium-1.3.3.jar:?]
    at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService$1.consume(CaesiumSchedulerService.java:285) [atlassian-scheduler-caesium-1.3.3.jar:?]
    at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService$1.consume(CaesiumSchedulerService.java:282) [atlassian-scheduler-caesium-1.3.3.jar:?]
    at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.executeJob(SchedulerQueueWorker.java:65) [atlassian-scheduler-caesium-1.3.3.jar:?]
    at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.executeNextJob(SchedulerQueueWorker.java:59) [atlassian-scheduler-caesium-1.3.3.jar:?]
    at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.run(SchedulerQueueWorker.java:34) [atlassian-scheduler-caesium-1.3.3.jar:?]
    at java.lang.Thread.run(Thread.java:745) [?:1.8.0_102]
Caused by: com.sun.mail.smtp.SMTPSendFailedException: 554 Message rejected: Email address is not verified. The following identities failed the check in region US-EAST-1: janbro@amazon.com, Jane Brooks <janbro@amazon.com>
    
    at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:2267) [javax.mail-1.5.6.jar:1.5.6]
    at com.sun.mail.smtp.SMTPTransport.finishData(SMTPTransport.java:2045) [javax.mail-1.5.6.jar:1.5.6]
    at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1260) [javax.mail-1.5.6.jar:1.5.6]
    at com.atlassian.mail.server.impl.SMTPMailServerImpl.sendMimeMessage(SMTPMailServerImpl.java:245) [atlassian-mail-2.7.18.jar:?]
    at com.atlassian.mail.server.managers.EventAwareSMTPMailServer.sendMimeMessage(EventAwareSMTPMailServer.java:25) [classes/:?]
    at com.atlassian.mail.server.impl.SMTPMailServerImpl.sendWithMessageId(SMTPMailServerImpl.java:187) [atlassian-mail-2.7.18.jar:?]
    ... 25 more
2017-10-05 00:34:00,745 ERROR [] Sending mailitem To='janbro@amazon.com,tam-hotdesk-emergency@amazon.com,jkolby@amazon.com,stievano@amazon.com,lipscomb@amazon.com,bthornell@amazon.com,lianggao@amazon.com,page-cpm-cn@amazon.com' Subject='Change Management 911: JTCP-128' From='janbro@amazon.com' FromName='Jane Brooks' Cc='' Bcc='' ReplyTo='null' InReplyTo='null' MimeType='text/plain' Encoding='UTF-8' Multipart='javax.mail.internet.MimeMultipart@5119ac9e' MessageId='null' ExcludeSubjectPrefix=false' anonymous    Mail Queue Service Error occurred in sending e-mail: To='janbro@amazon.com,tam-hotdesk-emergency@amazon.com,jkolby@amazon.com,stievano@amazon.com,lipscomb@amazon.com,bthornell@amazon.com,lianggao@amazon.com,page-cpm-cn@amazon.com' Subject='Change Management 911: JTCP-128' From='janbro@amazon.com' FromName='Jane Brooks' Cc='' Bcc='' ReplyTo='null' InReplyTo='null' MimeType='text/plain' Encoding='UTF-8' Multipart='javax.mail.internet.MimeMultipart@5119ac9e' MessageId='null' ExcludeSubjectPrefix=false'
com.atlassian.mail.MailException: com.sun.mail.smtp.SMTPSendFailedException: 554 Message rejected: Email address is not verified. The following identities failed the check in region US-EAST-1: janbro@amazon.com, Jane Brooks <janbro@amazon.com>
    
    at com.atlassian.mail.server.impl.SMTPMailServerImpl.sendWithMessageId(SMTPMailServerImpl.java:225) [atlassian-mail-2.7.18.jar:?]
    at com.atlassian.mail.queue.SingleMailQueueItem.send(SingleMailQueueItem.java:44) [atlassian-mail-2.7.18.jar:?]
    at com.atlassian.mail.queue.MailQueueImpl.sendBufferUnderLock(MailQueueImpl.java:103) [atlassian-mail-2.7.18.jar:?]
    at com.atlassian.mail.queue.MailQueueImpl.sendBuffer(MailQueueImpl.java:56) [atlassian-mail-2.7.18.jar:?]
    at com.atlassian.jira.mail.JiraMailQueue$1.apply(JiraMailQueue.java:51) [classes/:?]
    at com.atlassian.jira.mail.JiraMailQueue$1.apply(JiraMailQueue.java:48) [classes/:?]
    at com.atlassian.jira.util.velocity.DefaultVelocityRequestContextFactory.runWithStaticBaseUrl(DefaultVelocityRequestContextFactory.java:110) [classes/:?]
    at com.atlassian.jira.util.DefaultBaseUrl.runWithStaticBaseUrl(DefaultBaseUrl.java:50) [classes/:?]
    at com.atlassian.jira.mail.JiraMailQueue.sendBuffer(JiraMailQueue.java:48) [classes/:?]
    at com.atlassian.jira.service.services.mail.MailQueueService.run(MailQueueService.java:21) [classes/:?]
    at com.atlassian.jira.service.JiraServiceContainerImpl.run(JiraServiceContainerImpl.java:61) [classes/:?]
    at com.atlassian.jira.service.ServiceRunner.runService(ServiceRunner.java:62) [classes/:?]
    at com.atlassian.jira.service.ServiceRunner.runServiceId(ServiceRunner.java:44) [classes/:?]
    at com.atlassian.jira.service.ServiceRunner.runJob(ServiceRunner.java:32) [classes/:?]
    at com.atlassian.scheduler.core.JobLauncher.runJob(JobLauncher.java:153) [atlassian-scheduler-core-1.7.0.jar:?]
    at com.atlassian.scheduler.core.JobLauncher.launchAndBuildResponse(JobLauncher.java:118) [atlassian-scheduler-core-1.7.0.jar:?]
    at com.atlassian.scheduler.core.JobLauncher.launch(JobLauncher.java:97) [atlassian-scheduler-core-1.7.0.jar:?]
    at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.launchJob(CaesiumSchedulerService.java:443) [atlassian-scheduler-caesium-1.3.3.jar:?]
    at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeLocalJob(CaesiumSchedulerService.java:410) [atlassian-scheduler-caesium-1.3.3.jar:?]
    at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeQueuedJob(CaesiumSchedulerService.java:388) [atlassian-scheduler-caesium-1.3.3.jar:?]
    at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService$1.consume(CaesiumSchedulerService.java:285) [atlassian-scheduler-caesium-1.3.3.jar:?]
    at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService$1.consume(CaesiumSchedulerService.java:282) [atlassian-scheduler-caesium-1.3.3.jar:?]
    at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.executeJob(SchedulerQueueWorker.java:65) [atlassian-scheduler-caesium-1.3.3.jar:?]
    at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.executeNextJob(SchedulerQueueWorker.java:59) [atlassian-scheduler-caesium-1.3.3.jar:?]
    at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.run(SchedulerQueueWorker.java:34) [atlassian-scheduler-caesium-1.3.3.jar:?]
    at java.lang.Thread.run(Thread.java:745) [?:1.8.0_102]
Caused by: com.sun.mail.smtp.SMTPSendFailedException: 554 Message rejected: Email address is not verified. The following identities failed the check in region US-EAST-1: janbro@amazon.com, Jane Brooks <janbro@amazon.com>
    
    at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:2267) [javax.mail-1.5.6.jar:1.5.6]
    at com.sun.mail.smtp.SMTPTransport.finishData(SMTPTransport.java:2045) [javax.mail-1.5.6.jar:1.5.6]
    at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1260) [javax.mail-1.5.6.jar:1.5.6]
    at com.atlassian.mail.server.impl.SMTPMailServerImpl.sendMimeMessage(SMTPMailServerImpl.java:245) [atlassian-mail-2.7.18.jar:?]
    at com.atlassian.mail.server.managers.EventAwareSMTPMailServer.sendMimeMessage(EventAwareSMTPMailServer.java:25) [classes/:?]
    at com.atlassian.mail.server.impl.SMTPMailServerImpl.sendWithMessageId(SMTPMailServerImpl.java:187) [atlassian-mail-2.7.18.jar:?]
    ... 25 more

 JMWE Email Error's in the Mail Queue Error Tab.PNGJMWE Email Post Function in the list of Post Functions.PNGJMWE Email Post Function Screen Shot 1 of 2.PNGJMWE Email Post Function Screen Shot 2 of 2.PNG

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 29, 2018 in Marketplace Apps

How to set up an incident workflow from the VP of Engineering at Sentry

Hey Atlassian community, I help lead engineering at Sentry, an open-source error-tracking and monitoring tool that integrates with Jira. We started using Jira Software Cloud internally last year, a...

1,367 views 0 8
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you