Hi
I'm looking to create an escalation service that will set resolved jira tickets to "Close" status when they have been resolved for more than 7 days
However, on the "close" transition there is a required field called: Performance Feedback to prompt the user to enter a value
I would like to set this to a default value of: Met Expectations without manually setting it.
Below is the code. What is not working is setting the Performance fieldback field value to:
Met expectations.
In the escalation service:
I left the following unchecked:
skip permission
skip validator
skip condition
If i checked all of them, the performance feedback value is blank...
-------------------------------------------------------------------------
def cf = customFieldManager.getCustomFieldObjects(issue).find {it.name == 'Performance Feedback'}
issueInputParameters.addCustomFieldValue(cf.name, 'Met Expectations')
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.comments.CommentManager
CommentManager commentManager = ComponentAccessor.getCommentManager()
commentManager.create(issue, currentUser, 'This ticket has been in "Resolved" state for 7 or more days without an update. This ticket will be automatically moved to "Closed" state.', true)
-----------------------------------------------------------------------
Any help is appreciated.
Thanks,
Mary
Mary,
I just based mine on the template Scriptrunner provides. Please try something like this.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.comments.CommentManager
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def customField = customFieldManager.getCustomFieldObjectByName("Performance Feedback") // name of CF
def optionsManager = ComponentAccessor.getOptionsManager()
def fieldConfig = customField.getRelevantConfig(issue)
def option = optionsManager.getOptions(fieldConfig).find { it.value == "Met Expectations" } // value of option
issueInputParameters.addCustomFieldValue(customField.id, option.optionId as String)
issueInputParameters.setSkipScreenCheck(true)
CommentManager commentManager = ComponentAccessor.getCommentManager()
commentManager.create(issue, currentUser, 'This ticket has been in "Resolved" state for 7 or more days without an update. This ticket will be automatically moved to "Closed" state.', true)
Hi Kian,
This works!
Do i have to call this explicitly?
issueInputParameters.addCustomFieldValue(customField.id, option.optionId as String)
issueInputParameters.setSkipScreenCheck(true)
I already uncheck the boxes.. to not allow skip transition/condition/validator.
Thanks,
Mary
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.