cancel
Showing results for 
Search instead for 
Did you mean: 

PropertyNotFoundException in form

kaech
Champ in-the-making
Champ in-the-making
I am trying to map JavaBean properties to form properties as described in the user guide.

<userTask id="order" name="order" activiti:formKey="order.form">
<documentation>order</documentation>      
<extensionElements>
<activiti:formProperty id="quantity" variable="quantity" expression="#{order.quantity}" required="true" type="long" />
</extensionElements>

</userTask>

In the form I always get a javax.el.PropertyNotFoundExeption for the property quantity.
In ACT_RU_VARIABLE I only see the serialized JavaBean.
${order.quantity} is available in the form but ${quantity} is not.

Do you have any advice?
31 REPLIES 31

frederikherema1
Star Contributor
Star Contributor
Hi,

The "variable" attribute means that the value should be fetched from variable ${quantity}. You should just remove the variable attribute, if you're using the expression.

kaech
Champ in-the-making
Champ in-the-making
I tried it, but it does not work.

This is what I did:
<activiti:formProperty id="quantity" expression="#{order.quantity}" required="true" type="long" />

Do you have any other suggestions?

frederikherema1
Star Contributor
Star Contributor
Does your order-bean actually have a getQuantity()? The ELResolver resolves part by part, so when he's complaining about 'quantity' it might as well be the '.quantity' in  'order.quantity'…

kaech
Champ in-the-making
Champ in-the-making
I double checked, getQuantity is there.
I renamed quantity to thequantity like this:

<activiti:formProperty id="thequantity" expression="#{order.quantity}" required="true" type="long" />

Now Activiti throws a PropertyNotFoundException for thequantity.
In the form ${order.quantity} works but not ${thequantity}.

frederikherema1
Star Contributor
Star Contributor
Thats really strange… Could you perhaps create a test-case for this (http://activiti.org/userguide/index.html#apiUnitTesting), because I checked the code that is responsible for getting/setting form-property values, and error shouldn't occur when expression is filled in.

kaech
Champ in-the-making
Champ in-the-making
Yes, but that might take a while.
I am using Activiti 5.2. Could that be the reason?

frederikherema1
Star Contributor
Star Contributor
Hi,

Thats a possibility, although I don't see any changes to that are on first sight in SVN history…

kaech
Champ in-the-making
Champ in-the-making
Do I have to declare the taks form properties before they can be used?

The userguide says:
"So there is no need to declare task form properties if they match 1-1 with the process variables."

But what if they don't match 1-1 as in my case?

I never declared the task form properties and they are not submitted during the startEvent.
Could that be the problem?

frederikherema1
Star Contributor
Star Contributor
Not really sure shat you mean.

"So there is no need to declare task form properties if they match 1-1 with the process variables."
If you submit form-property values (in the Map<String, String>) for which no formProperty is defined in the process-definition, the form property value is just submitted (string) variable with the name of the variable equal to the id of the property (key in the map).