We need to set up a process in Jira where a task assigned to a team member cannot be moved to another sprint without the original reporter's confirmation.
Scenario:
How can we implement this in Jira?
Would it require workflow customization, automation rules, or a marketplace app like ScriptRunner?
I have tried to send notificiation to reporter by writing scrip lissiner via ScriptRunner, but it throws an error
assert resp.status == 204 | | | | 400 false status: 400 - Bad Request body: {"errorMessages":["No recipients were defined for notification."],"errors":{}}
Script:
import groovy.xml.MarkupBuilder
import groovy.xml.XmlSlurper
def eventIssue = Issues.getByKey(issue.key as String)
Map sprintChange = changelog?.items.find { it["field"] == "Sprint" } as Map
if (!sprintChange) {
return;
}
def fromSprint = sprintChange.from as String
def toSprint = sprintChange.to as String
def issueReporter = eventIssue.getReporter() ? eventIssue.getReporter() : eventIssue.getCreator()
if (fromSprint != toSprint) {
def writer = new StringWriter()
def markupBuilder = new MarkupBuilder(writer)
markupBuilder.div {
p {
// update url below:
a(href: "http://myjira.atlassian.net/issue/${issue.key}", issue.key)
span(" has had sprint change request from ${fromSprint} to ${toSprint}")
}
p("<p><b>${eventIssue.assigneeUser}</b> need to change sprint from sprint: <b>${fromSprint}</b> to: <b>${toSprint}</b> for <b>${issue.key}</b> </br> <p> Please go and review the updates on the ticket.</p>")
}
def htmlMessage = writer.toString()
def textMessage = new XmlSlurper().parseText(htmlMessage).text()
def recipients = [:]
recipients.users = [[accountId: issueReporter.accountId]]
recipients.reporter = true
logger.info("Irecipients ${recipients}")
def resp = post("/rest/api/2/issue/${issue.id}/notify")
.header("Content-Type", "application/json")
.body([
subject: 'Sprint Change Request',
textBody: textMessage,
htmlBody: htmlMessage,
to: recipients
])
.asString()
assert resp.status == 204
}
Would appreciate any guidance on the best approach to achieve this.
Thanks!
Please clarify: What ScriptRunner Component are you using for this? Is it the Listener?
I am looking forward to your feedback and clarification.
Thank you and Kind regards,
Ram
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.