// Get the key of the current issue
def issueKey = issue.key
// Get today's date
def today = new Date()
// Calculate the due date based on priority
def priority = issue.fields.priority?.name
def dueDate
switch (priority) {
case "Medium":
dueDate = today + 90
break
case "Low":
dueDate = today + 180
break
case "High":
dueDate = today + 30
break
case "Immediate":
dueDate = today + 7
break
default:
// Default to today + 90 for any other priority
dueDate = today + 90
}
// Prepare the API request to update the issue's due date
def result = put("/rest/api/2/issue/${issueKey}")
.header('Content-Type', 'application/json')
.body([
fields: [
// Set the due date based on the priority
duedate: dueDate.format('yyyy-MM-dd') as String
]
])
.asString()
// Print the result
println("Response from Jira API: ${result}")
import groovy.json.JsonBuilder
// Get the key of the current issue def issueKey = issue.key
// Get today's date def today = new Date()
// Calculate the due date based on priority def priority = issue.fields.priority?.name def dueDate switch (priority) { case "Medium": dueDate = today + 90 break case "Low": dueDate = today + 180 break case "High": dueDate = today + 30 break case "Immediate": dueDate = today + 7 break default: // Default to today + 90 for any other priority dueDate = today + 90 }
// Prepare the API request to update the issue's due date def result = put("/rest/api/2/issue/${issueKey}") .header('Content-Type', 'application/json') .body([ fields: [ // Set the due date based on the priority duedate: dueDate.format('yyyy-MM-dd') as String ] ]) .asString()
// Print the result println("Response from Jira API: ${result}")