My end goal is to restrict a project's issue creation to only a handful of issues, let's call them Document, Story, and Epic. I'm also very new to this add-on and scripting in general so apologies for any egregious errors; I hope it's an easy fix.
I think the following is syntactically correct but I can't get it to work. I have it set as an Initializer function and I've triple checked that my mapping is correct:
import static com.atlassian.jira.issue.IssueFieldConstants.ISSUE_TYPE
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.config.*
def allowedTypes = ConstantsManager.getAllIssueTypeObjects().findAll{
it.name in ["Document","Story","Epic"]}
getFieldById(ISSUE_TYPE).setFieldOptions(allowedTypes)
The logs say "Returning map: [:]" which makes me think I'm not using the right method to return issue types in the first place. Many of the current documentation/forum questions I do find are using deprecated methods like getIssueTypeObject. Does anyone have a working script or ideas?
We are using JIRA Server v 7.4.1, ScriptRunner 5.1.6.