Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save vikrantyadav11/026ee001891dda9311fc403e644fa618 to your computer and use it in GitHub Desktop.
Save vikrantyadav11/026ee001891dda9311fc403e644fa618 to your computer and use it in GitHub Desktop.
// Script Listener for Customer Facing Verbatim Field Updates
// Configure as "Issue Updated" event listener
// Get the updated issue
def issueKey = issue.key as String
def hapiIssue = Issues.getByKey(issueKey)
// Check if "Customer facing Verbatim" field was updated
def changelogItems = changelog.items
def customerFacingVerbatimChanged = changelogItems.find { item ->
item.field == "Customer facing Verbatim"
}
if (customerFacingVerbatimChanged) {
logger.info("Customer facing Verbatim field was updated for issue: ${issueKey}")
// Get the new value
def newValue = customerFacingVerbatimChanged.toString
logger.info("New value: ${newValue}")
// Response mapping
def responses = [
"Fix Released": "The issue has been fixed in [Version X.Y.Z] released on [Date]. Please upgrade to apply the fix.",
"Fix in Progress": "Actively working on a fix, expected in our upcoming patch [on Date].",
"Under Investigation": "The issue/request is under investigation. Updates will follow.",
"Workaround Provided": "[Share workaround].",
"Added to Backlog": "Logged for future consideration. We'll keep you posted.",
"Known Limitation": "Known product limitation. Under review for a future release.",
"Already Supported": "This feature exists. Access it via: [Instructions or link].",
"Answer Provided": "Requested info: [Add details].",
"More Information Needed": "Please clarify or provide more details on [specific part]."
]
// Update the response field based on the new value
if (responses.containsKey(newValue)) {
logger.info("Updating response field with: ${responses[newValue]}")
hapiIssue.update {
setSkipScreenCheck(true)
// Use numeric ID instead of customfield_20579
setCustomFieldValue(20579, responses[newValue])
}
logger.info("Response field updated successfully")
} else {
logger.info("No matching response found for value: ${newValue}")
// Clear the response field if no match
hapiIssue.update {
setSkipScreenCheck(true)
setCustomFieldValue(20579, "")
}
}
} else {
logger.debug("Customer facing Verbatim field was not updated in this change")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment