Hi All,
I hope you could help me with this cause i am struggling to get this to work... Also, I am not too clued up on Groovy Scripting so I am going based on researched, etc.
On JIRA Service Desk we have three fields we would like to limit based on a choice made in a dropdown. So the setup we have is something similar to below:
Custom Field Name: Car Brand (This is a single select list field)
AffectsVersion/s (this is the project system field)
Components (this is the project system field)
So, what im after is if the Car Name is set to Ford as an example, then the Affects Versions should only show a list [Fiesta, Figo... etc]. And the same applies to the components: Select Ford and the components would need to be narrowed down to a list [Engine, Gearbox.... etc]
I haver tried using behaviours and adding server side script but im so lost as what is what and how to do etc. I have the code below... but i am not sure if im on the right path
import com.atlassian.jira.component.ComponentAccessor
import static com.atlassian.jira.issue.IssueFieldConstants.AFFECTED_VERSIONS
import static com.atlassian.jira.issue.IssueFieldConstants.COMPONENTS
def productField = getFieldById(getFieldChanged())
def selectedProduct = productField.getValue() as String
def versionManager = ComponentAccessor.getVersionManager()
def versions = versionManager.getVersions(issueContext.projectObject)
def projectComponentManager = ComponentAccessor.getProjectComponentManager()
def components = projectComponentManager.findAllForProject(issueContext.projectObject.id)
if (selectedProduct == "Ford") {
getFieldById(AFFECTED_VERSIONS).setFieldOptions(["Figo","Focus"])
getFieldById(COMPONENTS).setFieldOptions(["Engine", "Gearbox"])
}