Bhavya-org / Scripts

0 stars 0 forks source link

Send email for ticket creation #42

Open sani-d opened 2 weeks ago

sani-d commented 2 weeks ago

issuetype in ( "TM alert ") and reporter = "Jira Bot" and issuetype not in subTaskIssueTypes() and "TM_Version[Number]" in (3.101, 3.102, 4.0)

summary: {{issue.summary.match("(company.{1,8})")}} Blocked Faster Payment

{{issue.description}}

Bhavya-ss commented 2 weeks ago

def issueKey = issue.key def issueType = issue.fields.issuetype.name def reporter = issue.fields.reporter?.accountId def number = issue.fields.customfield_10097?.toString() println("Issue Type: ${issueType}") println("Reporter: ${reporter}") println("Number: ${number}")

if (issueType == "Story" && reporter == "6305b88c958ffd78c6e0e59e" && !issue.fields.issuetype.subtask && ["3.101", "3.102", "4.0"].contains(number)) { println("Condition met") def resp = post("/rest/api/2/issue/${issueKey}/notify") .header("Content-Type", "application/json") .body([ subject: "${issue.fields.summary.find(/(company.{0,8})/)} Blocked Faster Payment", htmlBody: "${issue.fields.description}", to: [ users: [ [ accountId: '63060b97189e0a3a4ff283dc' ] ] ] ]) .asString()

println("Success")

} else { println("Condition not met") }