REST API complete task with variable

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2013 10:10 AM
I am trying to compete a task with a variable using REST API.
here is my xml
I always pass dicision value as "true" but I get false.
I pass value like this
please help
here is my xml
<userTask id="usertask1" name="User Task" activiti:assignee="${assignee}"> <extensionElements> <activiti:formProperty id="firstName" name="First Name" expression="${firstName}" writable="false"></activiti:formProperty> <activiti:formProperty id="lastName" name="Last Name" expression="${lastName}" writable="false"></activiti:formProperty> <activiti:formProperty id="groupName" name="Group Name" expression="${groupName}" writable="false"></activiti:formProperty> <activiti:formProperty id="decision" name="Do you approve the request ?" type="enum" required="true"> <activiti:value id="true" name="Yes"></activiti:value> <activiti:value id="false" name="No"></activiti:value> </activiti:formProperty> <activiti:taskListener event="complete" class="net.simplyfiIT.workflow.EndListener"></activiti:taskListener> </extensionElements> </userTask>
I always pass dicision value as "true" but I get false.
I pass value like this
{"decision":true}
please help
Labels:
- Labels:
-
Archive
8 REPLIES 8

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2013 12:49 PM
Hi,
That looks like a correct way of completing the task. Do you see false in the complete Task listener?
Could you verify if the value is also false by just calling the REST API again to get the process instance details?
Best regards,
That looks like a correct way of completing the task. Do you see false in the complete Task listener?
Could you verify if the value is also false by just calling the REST API again to get the process instance details?
Best regards,

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2013 05:02 AM
I see null in the complete the Task Listner.
In task listner i print the "dicision" value….It always print "null"
In task listner i print the "dicision" value….It always print "null"

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2013 04:10 PM
Try a string:
{"decision":"true"}
{"decision":"true"}

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2013 02:58 AM
Try a string:
{"decision":"true"}
If I try like above it will give an classcastexception…..
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2013 08:34 AM
What REST-API-call are you using? I see you're using form-properties, but the rest-api currently only supports adding actual variables.

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2013 11:26 AM
Try a string:
{"decision":"true"}
If I try like above it will give an classcastexception…..
The class cast exception is probably coming from wherever you are using the variable in your workflow. Change that to expect a string- either using the value directly "true" or by turning it into a boolean/etc.

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2013 05:04 AM
What REST-API-call are you using? I see you're using form-properties, but the rest-api currently only supports adding actual variables.
I'm using Complete Task through REST
by calling this
http://*******:6080/activiti-rest/service/task/{taskid}/complete
and pass this in body {"decision":true}
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2013 06:54 AM
What is the full stack trace of the class-cast exception you're getting? Also, is the variable you're trying to set already known in the process, before you try to set it using REST?
