How to display the value of a process variable in Camunda Forms

I would like to use Camunda Forms to display the value of a process variable dynamically, so that the user may see the ID and description of a certain Process Instance he is filling fields for. Is there a way to do this?

Thanks in advance.

Hi @EBrancher,

You can use the property Key in the general group to link the input to a variable:

1 Like

Hey Stephan, thank you for your reply. The proposed method will link the form field to the variable, so that when the user alters the value in the Camunda Form, it will alter the corresponding process variable to the new value.

This is working properly. My issue is, is there a way to display the current value of the variable in a text field, in a dynamic manner? So, for instance, if there is a variable called “description” in the process engine, can I create a field in the form that will display the value of “description” automatically, so that the Tasklist user may read it?

Thanks in advance.

Hello @EBrancher ,

the way @StephanHaarmann proposed works in both directions.

If you require this value to be read, just put it to readonly.

Jonathan

2 Likes

Hey @jonathan.lukas, thank you for your reply. I must have misconfigured something in my original test, I’ve managed to get the form field to display the variable value on a fresh deployment.

However I can’t seem to be able to set the text field to readonly in the Camunda Forms interface. I can do it on an HTML form with the ‘cam-variable-readonly’ directive, but how can I do the same on a Camunda Form? Do I have to place the directive somewhere in the form’s JSON?

Hello @EBrancher ,

on a text field, there should be a tick you can make which makes the field read-only.

Jonathan

1 Like

Oh, the “disabled” checkbox makes it readonly. I expected it to disable the field completely. TIcking it had the desired effect. Thanks for your help, I’ll mark Stephen’s answer as solution.

1 Like