I'm trying to restrict the behavior via the Script Runner Plugin for the "Resolution" field options. My objective is to restrict the options below to just one project (Other projects would have all options). I have got this working r one transition (per the web page example) but I want to widen that to the entire workflow if possible so that whenever the resolution field is selected you only get the five options shown below. I believe I need to change the line "if (getActionName()" but I'm sure what that value should be:
import com.atlassian.jira.component.ComponentAccessor
import static com.atlassian.jira.issue.IssueFieldConstants.RESOLUTION
if (getActionName() == "The Transition Name") {
def constantsManager = ComponentAccessor.getConstantsManager()
def allowedResolutions = constantsManager.getResolutionObjects().findAll {
it.name in ["QA Verified", "Approved", "Manager Approved", "CRB Approved","Emergency Approved"]
}.collectEntries {
[(it.id): it.name]
}
getFieldById(RESOLUTION).setFieldOptions(allowedResolutions)
Thanks in advance for any assistance someone can provide.
Hi Chris,
How about adding all Transitions where Resolution field is available in project something like this
if (getActionName() == "Resolved" || getActionName() == "Agree to close") {
}
Taha
I'm going to try this as a variant on the project. Thanks very much!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
When you configure any Behaviour, you can set the "Mapping" which helps you map the projects and issue types it is applied to. I take it you want to apply it to All project and issue types and do this programmatically - which is why you asked the question - right?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Chris,
if I get you right, you want to limit the resolutions shown to the user. You don't need behaviours for that.
Simply put the following propertiy on the transition where you want to limit the options:
Key: jira.field.resolution.include Value: 1,2,3<...>
The value is the ID of the resolution. You can find that in the DB or when you go to Resolutions: Hover over the configure button and look at the status bar in your browser. The last number is the ID you're looking for!
https://confluence.atlassian.com/jira/workflow-properties-189949.html
Cheers
Christian
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.