cancel
Showing results for 
Search instead for 
Did you mean: 

Required field not working

ilansch
Champ in-the-making
Champ in-the-making
Hi, I have created a simple model with 2 form properties variables.

The model has a start point, to the start i connected a user task, and connected the user task to end point.
in the user task i added 2 form properties and set them with "required" attribute:
<extensionElements>
<activiti:formProperty id="SomeID" name="Some ID" type="long" required="true"/>
<activiti:formProperty id="SomeName" name="Some Name" type="string" required="true"/>
</extensionElements>

now i am trying to send http message to the Rest API (via C#) to complete the task.

When i send the request with no variables in json body -> it is ok (get a response), how could it be ? shouldnt i get error message that the required variables are not in the json body?
second of all, when i am trying to send the json body variables, i get bad request message.
the json body looks like:
{\"action\":\"complete\",\"variables\":[{\"Name\":\"Some ID\",\"Value\":\"12345\"},{\"Name\":\"Some Name\",\"Value\":\"Moshe\"}]}

what is wrong with this ? maybe the variable type in body invalid ? i have set SomeID to be long, and in the json body it is string, does it know automatically to cast string to long?

Thanks
2 REPLIES 2

ilansch
Champ in-the-making
Champ in-the-making
json in body is:
"{\"action\":\"complete\",\"variables\":[{\"Name\":\"SomeID\",\"Value\":\"12345\"},{\"Name\":\"SomeName\",\"Value\":\"Moshe\"}]}"


The model WFWithVariables.bpmn20.xml looks like: http://pastebin.com/CFyMDYJV

jbarrez
Star Contributor
Star Contributor
No, the complete task method does not check form properties. You'll need to use the formService to do so.