cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping form properties to process variables

frecklefoot
Champ in-the-making
Champ in-the-making
I'm having trouble mapping a task's form property to a process variable.

Details:
I have a task with a form property, a boolean ("foo"). In the Form properties editor, I "map" the value to a process variable that I pass in ("bar"). So in the Value column for "foo" I have: ${bar}. From what I understand, this is supposed to map the value entered for "foo" (form property) into "bar" (process variable).

I pass "bar" into the process when I begin it with a default value (true or false). I execute the process using the API, not the Activiti Explorer. I set the value of "foo" like this:

      …
      FormService formService = processEngine.getFormService();
      Map<String, String> formProperties = new HashMap<String, String>();
      formProperties.put( "foo", "true" );
      
      formService.submitTaskFormData( taskId, formProperties );
      …

But whatever I enter for "foo", "bar" always ends up with the default value I pass in with it. It seems like the default value overrides the value I explicitly set. Is there a way to prevent this? I know that I am spelling "foo" correctly and am certain that "bar" is being set to the value I pass in with it.

Any idea what I am doing wrong?

Thanks in advance!
3 REPLIES 3

trademak
Star Contributor
Star Contributor
Hi,

If you want to map a form property to a process variable you can use the variable attribute.
So something like variable="bar"

Best regards,

hamed
Champ in-the-making
Champ in-the-making
Hi,

If you want to map a form property to a process variable you can use the variable attribute.
So something like variable="bar"

Best regards,
what do you mean by "variable attribute" ? can you explain or refer me to user guide or doc ?!

trademak
Star Contributor
Star Contributor
Hi,

You can find the description here: http://activiti.org/userguide/index.html#formProperties

From what I understand from your question this should work:

<activiti:formProperty id="foo" variable="bar" writable="true" />

Best regards,