It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Is it possible to send single email with bulk issues? Edited

Tyler Brown-Jones Dec 07, 2017

Hi Tyler here

 

So i am just wondering if it is possible to send a single email using XMLMarkupBuilder and the Rest API Notifiy request together to send a single email with bulk issues.

I am currently using Jira Cloud with ScriptRunner.

I am developing my script using the escalation service, so it prompts every day at 6pm to send an email.

My current code sends a single email per issue:

 

import groovy.xml.MarkupBuilder


if (issue.fields?.timetracking?.originalEstimate == null) {
def writer = new StringWriter()
def markupBuilder = new MarkupBuilder(writer)
markupBuilder.div {
p {
a(href: "https://test.atlassian.net/issue/${issue.key}", issue.key)
span("This issue does not have an Estimate")
}
}

def htmlMessage = writer.toString()
def textMessage = new XmlSlurper().parseText(htmlMessage).text()

def resp = post("/rest/api/2/issue/${issue.id}/notify")
.header("Content-Type", "application/json")
.body([
subject: "${issue.id} has no Estimate",
textBody: textMessage,
htmlBody: htmlMessage,
to: [
reporter: issue.fields.reporter != null, // bug - 500 error when no reporter
assignee: issue.fields.assignee != null, // bug - 500 error when no assignee
users: [[
name: 'Tyler Brown-Jones'
]],
groups: [[
// name: 'site-admins',
]]
]
]).asString()
logger.info(resp.toString())
assert resp.status == 204

}

I need this to send a single email with all the issues it captures with an estimate missing (This is due to having over 7000+ issues to go through). 

I hope you can help and many thanks

Tyler.

0 answers

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Posted in Marketplace Apps & Integrations

Demo Den Ep. 4: Continuous Integration with CircleCI & Jira Software

Get ready! Demo Den Episode 4 is coming your way on Tuesday, May 28, 2018 with a Continuous Integration and Delivery special demo. CircleCI Director of Solutions Engineering, Eddie Webb will show us ...

124 views 0 2
Join discussion

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you