Hi, I’m trying to set up a behavior.
I use it to display some options or others in a form field, depending on the request type of the parent task. I have the following script, but I am not able to set the options.
Any ideas or suggestions?
import com.atlassian.jira.component.ComponentAccessor
import org.apache.log4j.Logger
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.MutableIssue
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def optionsManager = ComponentAccessor.getOptionsManager()
def issueManager = ComponentAccessor.getIssueManager()
// Obtener el objeto del padre
def parentIssue = underlyingIssue.parentObject
def nombrePadre = parentIssue.getIssueType().getName()
// Obtener el campo select list
def selectList = getFieldById("10370")
log.info "selectList: ${selectList}"
// Obtenemos el id del select list
def customField= customFieldManager.getCustomFieldObject(selectList.getFieldId() as Integer)
def config = customField.getRelevantConfig(getIssueContext())
def options = optionsManager.getOptions(config)
def optionsMap
// Logical operations
if (nombrePadre == "ZGE" ){ //|| nombrePadre == "ZSI"
optionsMap = optionsManager.getOptions(config).findAll{
it.value in ["ZPP","ZPA","ZSI"]
}.collectEntries {
[(it.optionId.toString()): it.value]
}
selectList.setFieldOptions(optionsMap)
}
Hi @Javier Martinez Caballero Below link may help find you the solution.
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.