I have two single select dropdown menu custom field called
Custom field one= Product ( I have 9 options under this list)
Custom field two= Component
So now when someone select Infrastructure from Product then in Component List I want to see the following options; Automation, testing, developing, other.
I am using behavior from script runner but it seems not to be working for me.
Can you please guide me with this?
Hello @Sonal Sharma ,
Please create a behaviours and link it to the Product field, and use this script (please update the custom fields ids) :
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
import com.atlassian.jira.component.ComponentAccessor
def optionsManager = ComponentAccessor.getOptionsManager()
def productId = 11001
def componentId = 11002
def productField = getFieldById("customfield_"+productId)
def productFieldValue = productField.getValue()
def componentField = getFieldById("customfield_"+componentId)
def component = ComponentAccessor.getCustomFieldManager().getCustomFieldObject(componentId)
def componentConfig = component.getRelevantConfig(getIssueContext())
def componentOptions = optionsManager.getOptions(componentConfig).findAll { !it.getDisabled() }
def componentList = ["Automation","testing","developing","others"]
def componentsOptionsMap = componentOptions.findAll()
if ((productFieldValue == "Infrastructure") || ("Infrastructure" in productFieldValue)){
componentsOptionsMap = componentOptions.findAll{ it.value in componentList }
}
componentField.setFieldOptions(componentsOptionsMap)
Let me know if that works.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Antoine Berry Thanks for the support but it is not working for me, I don't see any changes in the behavior.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.