I'm having trouble finding simple issue transition code that actually functions in Jira Cloud. I'm trying to set up a ScriptRunner listener for issue updates.
When specific criteria are met (Through my own code logic, not transition validation which I know doesn't work in cloud) I'm trying to transition my issue status. No matter what I do though, I'm still getting the error 'unable to resolve class IssueService'.
Being on cloud, I can't import the proper packages, and I can't find a simple solution anywhere that fits my use case. How can I actually use any of the IssueService methods, or what alternatives am I supposed to use in Cloud?
Thanks in advance.
Edit: Here's my code after much finagling.
/*Modified from following source:
https://community.atlassian.com/t5/Marketplace-Apps-questions/ScriptRunner-how-to-change-status-of-an-Issue/qaq-p/628842
*/
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def issueManager = ComponentAccessor.issueManager
def issue = issueManager.getIssueObject(event.issue.key)
IssueService issueService = ComponentAccessor.getIssueService()
def actionId = 10017 //Transition ID
def customFieldManager = ComponentAccessor.getCustomFieldManager()
if (issue.getStatus().name == "Unassigned" && issue.getAssigneeUser() != null) {
transitionResult = issueService.transition(currentUser, transitionValidationResult)
//Find docs for transition, replace transitionValidationResult
if (transitionResult.isValid()) {
log.debug("Transitioned issue $issue through action $actionId")
}
else {
log.debug("Transition result is not valid")
}
}