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.