Hello,
We have a multi select list field with different values. It is called 'Tool/s' . (values are: JIRA, Confluence, Github , etc).
We want that a description is added to the 'description' field when certain values are selected in the 'Tool/s' field:
def Tools = getFieldByName("Tool/s")
def descField = getFieldById("description")
def toolsvalue = Tools.getValue()
if (toolsvalue.toString().contains("JIRA")) { // choose tools by name
descField.setHelpText("text added here.")
descField.setRequired(true)
} else if (toolsvalue.toString().contains("Github")) {
descField.setHelpText("a different help text ")
descField.setRequired(true)
}
else if (toolsvalue.toString().contains("Confluence")) {
descField.setHelpText("confluence specific text")
descField.setRequired(true)
}
else {
descField.clearHelpText()
descField.setRequired(false)
}
This works when individual values are selected. But "Tool/s" is a multiple select list, and the above code does not work when both "JIRA" & "Confluence" are selected, or when all of the values are selected.
Please let me know if that would be possible, and how.
Thank you!
It's not working because else if only applies if previous if/else if were false
Something like this, obviously taking care of adding the correct format between texts
def finaltext = ""
if (toolsvalue.toString().contains("JIRA")) { // choose tools by name
finaltext = "text added here."
}
if (toolsvalue.toString().contains("Github")) {
finaltext = finaltext + "a different help text "
}
if (toolsvalue.toString().contains("Confluence")) {
finaltext = finaltext + "confluence specific text"
}
if (finaltext=="" {
descField.clearHelpText()
descField.setRequired(false)
}else{
descField.setHelpText(finaltext)
descField.setRequired(true)
}
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.