Hello, I am trying to prevent users from selecting more than one component when creating, or editing an issue. Is this possible?
Thanks
Behavior Plugin has the solution:
https://jamieechlin.atlassian.net/wiki/display/JBHV/Miscellaneous+Behaviours+Examples#MiscellaneousBehavioursExamples-Allowonlyasinglecomponenttobeselected
Hi Udo - thanks. I installed plugin - followed steps but I'm still able to select mutiple components when creating or editing an issue. no errors are generated when I save the server side script, but other behaviours that I ghave setup for test appear to be working OK.
Here is the script I'm using: - (are you able to see what I'm doing wrong?)
import com.onresolve.jira.groovy.user.FieldBehavioursimport com.onresolve.jira.groovy.user.FormFieldimport com.atlassian.jira.ComponentManager
class SingleComponentOnly extends FieldBehaviours { ComponentManager componentManager = ComponentManager.getInstance() public void allowOnlySingleComponent() { FormField formComponent = getFieldById(fieldChanged) // if it's a list it has more than one value if (formComponent.getFormValue() instanceof List) { formComponent.with { setValid(false) String s = "Please select only one component." setTitle (s) setHelpText("<div class=\"warningBox\">$s</div>") } } else { formComponent.with { setValid(true) String s = "" setTitle (s) setHelpText("") } } }}
Hi James,
Unfortunately I'm not able to see why it is not working. But I saw that you already asked that question.
https://answers.atlassian.com/questions/235984/behaviours-plugin-how-to-prevent-multi-select-on-components-field
Maybe you will get an answer there.
yeah, albeit a slightly different question - the other question relates to why the code copied from the website doesn't compile, but if I change 'package' to import at the top of the code then it compiles, but doesn't work...
It looks like you're new here. Sign in or register to get started.