Hi Atlassian Community,
Looking to create a script fragment to hide the "Create Sub-task" button under the "More" tab in a Jira issue view.
It works for a single project and single group but I would like to add in additional groups and projects.
This code works:
For project ABC, I can see and create a sub-task option from the "More" menu when I am in the ABC_managing team. If I am not in the group, I will not be able to see the "create sub-task" option
import com.atlassian.jira.component.ComponentAccessor
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def groupManager = ComponentAccessor.getGroupManager()
//When there are multiple projects
def projectKeyList = ['ABC']
!(jiraHelper.project?.key in projectKeyList) || (groupManager.isUserInGroup(currentUser,"ABC_managing team"))
However, as soon as I add in the following for additional groups and projects, the code no longer works.
import com.atlassian.jira.component.ComponentAccessor
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def groupManager = ComponentAccessor.getGroupManager()
//def user = ComponentAccessor.jiraAuthenticationContext.loggedInUser
//def GROUP = ['accind_managing team']
//When there are multiple projects
def projectKeyList = ['ABC, 'DEF']
!(jiraHelper.project?.key in projectKeyList) || (groupManager.isUserInGroup(currentUser,"ABC_managing team")) || (groupManager.isUserInGroup(currentUser,"DEF_managing team"))
Would appreciate if someone can review to let me know what I am doing wrong.
Thanks in advance.
Mary