Saving form data

Hi,

I have a simple form, attached to multiple task in multiple processes, containing only a text field.

How can I connect a process variable to it and make sure that the value I write in text field gets updated?

V.

All form fields map to a process instance instance variable. If a variable has a value and the field has the same name as the variable, the value will be shown.

Thank you on fast reply.

Regards

Just one more question about the type of variable.

Im using json structure as a type of variable type and I can access the value for some property from json structure, but how do I map it to other type of “containter” on form, i.e. text fields, number of any other?

Kind regards,
V

Assuming you have a JSON variable (player) with the following structure:

{
“id”: 7,
“name”: “John Doe”,
“age”: 22,
“hobbies”: {
“indoor”: [
“Chess”
],
“outdoor”: [
“BasketballStand-up Comedy”
]
}
}

You can access any individual element using standard JSON dot notation.
So to access the “age” you would use player.age and so forth.

1 Like

Thank you on your answer.

One more question regarding that - in ID field I cant put format like you wrote, e.i. player.dot.

This is a picture of text form field, and its not working. Does that means that I can only user Exoression field on forms to show data?

Hi,
First off, I apologize as I didnt realize you were using the open source version of Flowable.
You wont be able to directly reference the elements of a JSON node using simple dot notation in a form with OSS version.
You will need to retrieve the JSON variable, parse it and save the fields you want to display as primitives.

E.g. var json = execution.getVariable(‘json’);
var name = JSON.parse(json.textValue()).name;

execution.setVariable(‘name’, name)

You can now reference name in your form.

1 Like

Thank you very much on explanation.

Regards,
V.