Features used to implement the example



Example: Getting the number of selected values in a custom field of type Multi Select

I'm looking for a solution to check number of selected values of a multi select custom field. Based on that result another custom field has to be set (e.g. to number of items selected in the field to be checked) Is there a way to use the "Update parameters" of the Mathematical and date-time expression calculator post-function for this transition functionality of Jira Workflow Toolbox?

I have just released version 2.0.18 of Jira Workflow Toolbox. This version implements a new function in the mathematical expression parser called "numberOfSelectedItems(field_id)". This function returns the number of items selected in a multi select field, version picker, multi user field, components, fix version/s, affects version/s and labels.

Now there is a very easy way to set a custom field of type Number with the number of items selected in another custom field of type Multi Select.

You can use post-function Mathematical and date-time expression calculator in the way I show you in the following screenshots:


Once configured, the transitions looks like this:



Notice that I have used an auxiliary field "Ephemeral number 1" as intermediary, instead of copying the result of "numberOfSelectedItems({Colours})" directly to custom field "Number of selected options"I have done it this way because there is a very strange bug in the plugin that prevents post-functions Copy parsed text to a field and Mathematical and date-time expression calculator to copy directly to custom fields (not to virtual fields) when the post-function is in first place in execution order. That is why I have introduced an assignment to an auxiliary field in first position, so that assignment to custom field is done in second position. Another possible workaround is to move the post-function to a lower position in the order of execution. 

Update

The bug I talk about in the last message was fixed in version 2.1.16 of the plugin. Anyway, it only happened when writing into a custom field and issue resolution was set. Now it is not needed to use any intermediary field, so you can do it with only one post-function Mathematical and date-time expression calculator, selecting field "Number of selected options" as Target field, and introducing "numberOfSelectedItems({10600})" in parameter Formula.



Other examples of that function



Related Usage Examples