Open Bhavya-ss opened 3 weeks ago
def issueKey = issue.key
// Notification part with request type condition def requestBody = [ subject: "Issue ${issue.key} is now archived", htmlBody: "Issue ${issue.key} was archived", to: [ users: [ [accountId: "63060b97189e0a3a4ff283dc"], [accountId: "630a0d15ec02b5f28b63a024"] ] ] ] def status = issue.fields.status?.name def requestType = issue.fields.customfield_10010?.requestType?.name
if (requestType == "Get IT help" && status == "Closed") { def resp = post("/rest/api/3/issue/${issueKey}/notify") .header("Content-Type", "application/json") .body(requestBody) .asString()
// Handle notification response if (resp.status == 200 || resp.status == 204) { println "Notification sent successfully." } else { println "Failed to send notification. Status code: ${resp.status}, Response body: ${resp.body}" }
} else { println("Request type is not 'Get IT help' or status is not 'Closed', skipping automated actions.") }
def issueKey = issue.key
// Notification part with request type condition def requestBody = [ subject: "Issue ${issue.key} is now archived", htmlBody: "Issue ${issue.key} was archived", to: [ users: [ [accountId: "63060b97189e0a3a4ff283dc"], [accountId: "630a0d15ec02b5f28b63a024"] ] ] ] def status = issue.fields.status?.name def requestType = issue.fields.customfield_10010?.requestType?.name
if (requestType == "Get IT help" && status == "Closed") { def resp = post("/rest/api/3/issue/${issueKey}/notify") .header("Content-Type", "application/json") .body(requestBody) .asString()
} else { println("Request type is not 'Get IT help' or status is not 'Closed', skipping automated actions.") }