MultiSelect on the .vm file
There might be other ways to create your own MultiSelect customfield, however one of the easiest ways is to extend the MultiSelectCFType and then Override the methods which you might need depending on what you want to achieve.
In order to populate the options for the MultiSelectCFType/SelectCFType there is a mandatory function/method to @Override, which is public Object getValueFromIssue (CustomField field, Issue issue). This is because you want the customfield to get options from a specified data centre which can be maintained by the user. It is not advisable to hard code the options in case they have to change, as the user might not have access to the code (because a .jar/.obr file is used to install the plugin).
When creating a workwork1 and adding a MultiSelect in the .vm file, it sometimes gets a bit tricky in terms of getting the selected options.
Well, its actually crazy easy. On your java file where you get the parameters, this is how you would do it:
options = newArrayList((String) ActionContext.getParameters().get(“nameOfYourMultiSelect”));
Not like this:
options = newArrayList((String) ActionContext.getParameters().get(“manager”));
The reason for this is that the tailing ‘’ takes only the first element of the array, while if you leave it out you get the whole array with options.
Cool right? 😉
BY: CHRIS M, SOFTWARE DEVELOPER AT INFOWARE STUDIOS
Interesting Infoware Studios Bookmarks
- See my delicious