Open pramodhm112 opened 5 months ago
def issueKey = issue.key def division = issue.fields.customfield_10249?.value def departmentPSD = issue.fields.customfield_10250?.value
println "Issue Key: $issueKey" println "Division: $division" println "Department PSD: $departmentPSD"
// Define the new request participants array with account IDs def newRequestParticipants = []
if (["Product Verticals", "Technology"].contains(division) && ["Business Services", "Credit Services", "Financial Services", "Payment Services", "Agile Delivery", "Backend", "Business Intelligence", "Client Engineering", "Cloud Engineering", "Data Science", "IT & Infrastructure", "Mobile & Web Engineering", "QA Automation & Releases", "Technology Planning & Operations"].contains(departmentPSD)) { // Add account IDs to newRequestParticipants array newRequestParticipants.add("63d0b9efa197e05f9dadb169") println "Adding account ID 63d0b9efa197e05f9dadb169" } else if (["Finance", "Marketing Horizontals IN", "Marketing Horizontals UK/EU"].contains(division) && ["Finance", "Member Accession Marketing", "Member Engagement Marketing", "Partner Credit Services"].contains(departmentPSD)) { // Add account IDs to newRequestParticipants array newRequestParticipants.add("6305b88c958ffd78c6e0e59e") println "Adding account ID 6305b88c958ffd78c6e0e59e" } else if (["Executive", "People & Culture"].contains(division) && ["Executive", "People Partnering"].contains(departmentPSD)) { // Add account IDs to newRequestParticipants array newRequestParticipants.add("6305b7edb155e59f6955bf9e") println "Adding account ID 6305b7edb155e59f6955bf9e" } else if (["Design", "UX & Brand", "Marketing Horizontals IN", "Product Verticals"].contains(division) && ["Design", "UX & Brand", "Member Accession Marketing", "Member Engagement Marketing"].contains(departmentPSD)) { // Add account IDs to newRequestParticipants array newRequestParticipants.add("63d0b9efa197e05f9dadb169") newRequestParticipants.add("6305b88c958ffd78c6e0e59e") println "Adding account IDs 63d0b9efa197e05f9dadb169 and 6305b88c958ffd78c6e0e59e" } else if (division == "Marketing Horizontals IN" && departmentPSD == "Member Engagement Marketing") { // Add account IDs to newRequestParticipants array newRequestParticipants.add("6305b7edb155e59f6955bf9e") println "Adding account ID 6305b7edb155e59f6955bf9e" } else if (["Marketing Horizontals IN", "Member Operations IN", "Support"].contains(division) && ["Member Accession Marketing", "KYC", "Member Support", "Ongoing Monitoring", "Operations Support", "Special Projects"].contains(departmentPSD)) { // Add account IDs to newRequestParticipants array newRequestParticipants.add("6305b88c958ffd78c6e0e59e") newRequestParticipants.add("6305b7edb155e59f6955bf9e") println "Adding account IDs 6305b88c958ffd78c6e0e59e and 6305b7edb155e59f6955bf9e" } else if (["People & Culture", "Risk & Compliance", "Support"].contains(division) && ["Legal", "People Experience", "People Managers", "People Operations", "Talent Acquisition", "Compliance", "FinCrime Risk", "InfoSec", "Quality Control", "Risk", "Corporate Development", "Executive Assistance", "PR & Communications"].contains(departmentPSD)) { // Add account IDs to newRequestParticipants array newRequestParticipants.add("6305b7edb155e59f6955bf9e") println "Adding account ID 6305b7edb155e59f6955bf9e" } else if (division == "Member Operations UK/EU" && ["KYC", "Member Support", "Ongoing Monitoring", "Operations Support", "Training"].contains(departmentPSD)) { // Add account IDs to newRequestParticipants array newRequestParticipants.add("6305b88c958ffd78c6e0e59e") newRequestParticipants.add("63176aa38d88ec800fbf9b17") println "Adding account IDs 6305b88c958ffd78c6e0e59e and 63176aa38d88ec800fbf9b17" }
println "New Request Participants: $newRequestParticipants"
// Define the function to update request participants def updateRequestParticipants = { -> // Update the request participants field with the correct structure def updateResult = put('/rest/api/2/issue/' + issueKey) .header('Content-Type', 'application/json') .body([ fields: [ customfield_10127: newRequestParticipants.collect { ["accountId": it] } // Use the correct custom field ID ] ]) .asString()
println "Update Result: $updateResult"
}
// Call the update function updateRequestParticipants()
def issueKey = issue.key def division = issue.fields.customfield_14275?.value def departmentPSD = issue.fields.customfield_14453?.value
// Define the new request participants array with account IDs def newRequestParticipants = []
if (["Product Verticals", "Technology"].contains(division) && ["Business Services", "Credit Services", "Financial Services", "Payment Services", "Agile Delivery", "Backend", "Business Intelligence", "Client Engineering", "Cloud Engineering", "Data Science", "IT & Infrastructure", "Mobile & Web Engineering", "QA Automation & Releases", "Technology Planning & Operations"].contains(departmentPSD)) { // Add account IDs to newRequestParticipants array newRequestParticipants.add(["accountId": "712020:b2e94b32-498a-40f3-9c0c-488ee1febb78"]) } else if (["Finance", "Marketing Horizontals IN", "Marketing Horizontals UK/EU"].contains(division) && ["Finance", "Member Accession Marketing", "Member Engagement Marketing", "Partner Credit Services"].contains(departmentPSD)) { // Add account IDs to newRequestParticipants array newRequestParticipants.add(["accountId": "634b526e48be855a65ede252"]) } else if (["Executive", "People & Culture"].contains(division) && ["Executive", "People Partnering"].contains(departmentPSD)) { // Add account IDs to newRequestParticipants array newRequestParticipants.add(["accountId": "5f3136b3fcaf93003b64fcb4"]) } else if (["Design", "UX & Brand", "Marketing Horizontals IN", "Product Verticals"].contains(division) && ["Design", "UX & Brand", "Member Accession Marketing", "Member Engagement Marketing"].contains(departmentPSD)) { // Add account IDs to newRequestParticipants array newRequestParticipants.add(["accountId": "634b526e48be855a65ede252"], ["accountId": "712020:b2e94b32-498a-40f3-9c0c-488ee1febb78"]) } else if (division == "Marketing Horizontals IN" && departmentPSD == "Member Engagement Marketing") { // Add account IDs to newRequestParticipants array newRequestParticipants.add(["accountId": "62707d803d0b580069465ed4"]) } else if (["Marketing Horizontals IN", "Member Operations IN", "Support"].contains(division) && ["Member Accession Marketing", "KYC", "Member Support", "Ongoing Monitoring", "Operations Support", "Special Projects"].contains(departmentPSD)) { // Add account IDs to newRequestParticipants array newRequestParticipants.add(["accountId": "62707d803d0b580069465ed4"], ["accountId": "712020:7300fbe0-65cf-4087-8529-e8109f13ff07"]) } else if (["People & Culture", "Risk & Compliance", "Support"].contains(division) && ["Legal", "People Experience", "People Managers", "People Operations", "Talent Acquisition", "Compliance", "FinCrime Risk", "InfoSec", "Quality Control", "Risk", "Corporate Development", "Executive Assistance", "PR & Communications"].contains(departmentPSD)) { // Add account IDs to newRequestParticipants array newRequestParticipants.add(["accountId": "61d0f0da90cfd20071e2916c"]) } else if (division == "Member Operations UK/EU" && ["KYC", "Member Support", "Ongoing Monitoring", "Operations Support", "Training"].contains(departmentPSD)) { // Add account IDs to newRequestParticipants array newRequestParticipants.add(["accountId": "5e7338e817c6640c385f3e66"], ["accountId": "712020:8abf06d4-3bc6-4d1b-8d60-8484a2cc1f1a"]) }
def updateRequestParticipants = { -> // Update the request participants field with the correct structure def updateResult = put('/rest/api/2/issue/' + issueKey) .header('Content-Type', 'application/json') .body([ fields: [ customfield_10849: newRequestParticipants // Use the correct custom field ID ] ]) .asString() }