How to use a LIST/ARRAY with Camunda 8 forms

Hi there,

I have been trying to use Camunda 8 forms to accept list of inputs from user, like a user entering multiple IDs which can be assigned to a list variable and then that list can be passed as an input to execute a a DMN evaluating the list of inputs using feel expression.

But I am unable to use a list variable with Camunda 8 forms, please could you advise if this is possible and how this can be achieved.

Please share any examples/references if available.

Thanks in advance

Hi @DIID_RAO,

The simplest workaround is to use string fields and allow the user to specify the values delimited. E.g. comma-separated IDs. Then you can either use that value directly in the dmn, e.g. to check if comma-separated list with optional white-spaces contains ID “123”: matches(input, "(^|,)\\s*123\\s*($|,)") or if you want to have the list you can transform the variable e.g. with a custom connector that just takes a variable name and delimiter and maybe some options like trim values or duplicate removal.

A nice solution would be to create a new form element that allows you to add multiple values. I don’t know enough about that, sorry.

Sometimes if only a few values are possible then you can just place some placeholders (e.g. ID1, ID2, ID3 if max 3 IDs). Another workaround.

thanks cma,
Using a list variable is a very basic functionality, do we really need to create a connector to use list variable ? is there no support for list/array variables in Camunda modeler itself ?

thanks

Unfortunately no, at the moment this is not supported. I know Camunda is working on the modeler but I don’t know what features will come next.

Hi @DIID_RAO,

In Camunda version 8.4 we introduced a Dynamic list form component that lets you operate with a list of data and arrays.

You can read more about it here:

To bind the form’s list inputs to process data, please check this documentation page:

Hope it helps!

1 Like

Interesting, I hope we will also get a dynamic list for connector forms (element template JSON).

thanks for that, in 8.3 is there a way to show list/array content on the form ? I have tried mapping it to text area but it doesn’t show up as it seems text area just renders a string field and not an array/list. any other form component that can help me render a list on UI in 8.3 ?

Hey there.

is there a way to show list/array content on the form ?

If it’s just a matter of displaying array content, in 8.3 you can use the text component to display your array.

Either in a very literal like so:

Or with a bit more flexibility using some of the text templating iteration features:

The component also supports some limited use of HTML tags.

More on text templating here:

In 8.5 we are introducing an HTML component which will allow a lot more flexibility in rendering.

Using a list variable is a very basic functionality

There’s probably a place for a string list component similar to the tag-list in the form editor. Something a bit more lightweight than the dynamic list. But for now it’s not available.

Hope that answers things for you.
Let us know if you’ve got other questions.