Forums

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

How to Require Reporter Approval Before Moving an Issue to Another Sprint?

Marine Gasparyan February 4, 2025

 

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:

  • USER_X (Reporter) assigns a task to a team member for a specific sprint (e.g., Sprint 2).
  • The team member wants to move the task to another sprint (e.g., Sprint 3).
  • Before the change happens, a confirmation request should be sent to USER_X.
  • Only after USER_X approves, the task should be moved to the new sprint.

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!

1 answer

0 votes
Ram Kumar Aravindakshan _Adaptavist_
Community Champion
February 23, 2025

Hi @Marine Gasparyan

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

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events