I am trying to create an escalation service that will close tickets greater than 7 days, sets the resolution to completed and adds a comment. In the workflow, when the close button (transition) is selected, a transition screen pops up and prompts user to select resolution and a value. The field resolution is a of type select list. The value to set should be "completed" I would like to bypass the transition screen and automatically set the status as closed, resolution as completed.
The code I have is the following but it is not working. It mentions that
--------------------------------------------------------------------------------------------
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.comments.CommentManager
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def cfSelect = ComponentAccessor.customFieldManager.getCustomFieldObjectByName("Resolution")
def cfConfig = selectCf.getRelevantConfig(issue)
def value = ComponentAccessor.optionsManager.getOptions(cfConfig)?.find {
it.toString() == 'Completed'
}
issue.setCustomFieldValue(cfSelect, value)
issueInputParameters.addCustomFieldValue(customField.id, option.optionId as String)
//issueInputParameters.setSkipScreenCheck(true)
CommentManager commentManager = ComponentAccessor.getCommentManager()
commentManager.create(issue, currentUser, 'status set to close, resolution is completed and ticket has been automatically closed.', true)