Hi Community,
I have created a Select List (multi-choose) custom field "Platform" and added three options: Jira, Confluence, BitBucket.
I want to hide above option of "Platform" field based on user conditions.
If a jira user opens the issue in edit screen, he only gets JIRA option in Platform drop-down,
If Confluence user opens the issue in edit screen, he only see Confluence option in Platform drop-down. Similarly with Bitbucket user.
Please guide how I can configure the above configuration using Scriptrunner, JMWE, or Jira automation or any conditions, validations, or post function in workflow.
Thanks
I would normally attack this via Scriptrunner's behaviors.
Here is another question that is very close to your request except they are using another field to limit the choice list instead of the user.
You should be able to modify this to base it off the currentuser.
Thank you so much @Shawn Doyle - ReleaseTEAM for the useful link. It helped me to achieve my requirements.
Sharing the below code block with community, if you are looking how to hide an option(s) of a Select List (multi-choose) field from a specific user group(s):
import com.atlassian.jira.component.ComponentAccessor
def groupManager = ComponentAccessor.getGroupManager()
def group1 = ComponentAccessor.groupManager.getGroup("JIRA Users Group")
def group2 = ComponentAccessor.groupManager.getGroup("Confluence Users Group")
def group3 = ComponentAccessor.groupManager.getGroup("Bitbucket Users Group")
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def customFieldManager = ComponentAccessor.customFieldManager
def optionsManager = ComponentAccessor.optionsManager
def platformQus = getFieldByName("Platform")
def platformQusCF = customFieldManager.getCustomFieldObjectsByName("Platform")[0]
def config = platformQusCF.getRelevantConfig(getIssueContext())
def options = optionsManager.getOptions(config)
if((ComponentAccessor.getGroupManager().getGroupsForUser(currentUser)?.find
{(it.name == "JIRA Users Group")
&& it.name != "Confluence Users Group"
&& it.name != "Bitbucket Users Group"}))
{
def newOptions = options.findAll
{it.value in ["JIRA"]}
platformQus.setFieldOptions(newOptions)
}
else
{
def newOptions = options.findAll
{it.value in ["Confluence", "Bitbucket"]}
platformQus.setFieldOptions(newOptions)
}
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.