Generated Task Form, issue with localVariable for enum form field

Hi,

for a prototype I want to utilize Generated Task Form to allow user to select from a drop down.
Form field for the variable is type enum.

Variable has to be created in the scope of the subprocess.
I usually use javascript at the start event listener of the subprocess.

execution.setVariableLocal(‘exceptionCode’, ‘’);

This approach works fine for boolean or string types however if the variable type is enum in the form I get following error:

Form failure: ← Cannot get form for task 7b42cd8c-936b-11e9-aecf-000c29ad85ce

Any idea how to overcome this problem?

form_issue.bpmn (4.6 KB)

Thanks!

Ingo

@pitu72 The problem is with your form field ID. You cannot use exceptionCode as id since it may be some reserved variable.

Just rename the ID and your form should work fine. Attached a working version of your form form_issue-fixed.bpmn (4.6 KB)

Hi, thanks for coming back on that.
However it is not solving my problem.

Your solution created a variable which is created in the scope of the main process.
I wanted to create it locally in the scope of the multi instance subprocess using the start event listener of the same. This is what seems not to work for a variable that is used in the generated task form enum field. Im wondering if there is method to create it with javascript.

Ingo

Hi @pitu72,

enum type means value should be one of your defined list of values or null

Try to set your local variable to one of your enum defined values instead of empty string

<camunda:value id=“test1” name=“Test1” />
<camunda:value id=“test2” name=“Test2” />

For example:
execution.setVariableLocal(‘exceptionCode’, ‘test1’);

1 Like

Thanks a lot. Working fine and makes sense too.

Ingo