cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to retrieve tasks using Rest api

ganeshr
Champ in-the-making
Champ in-the-making
I have been trying to retrieve tasks using rest api, using uri - http://localhost:9090/activiti-rest/service/tasks?[assignee={userid}|candidate={userid}|candidate-group={groupid}]"
  For that candidate group tasks are available but still it is giving empty data. When checked in tomcat cosole it has the folowing errors,

Caused by: org.activiti.engine.impl.javax.el.PropertyNotFoundException: Cannot resolve identifier 'taskPayloadData'
        at org.activiti.engine.impl.juel.AstIdentifier.eval(AstIdentifier.java:83)
        at org.activiti.engine.impl.juel.AstProperty.eval(AstProperty.java:52)
        at org.activiti.engine.impl.juel.AstProperty.eval(AstProperty.java:52)
        at org.activiti.engine.impl.juel.AstEval.eval(AstEval.java:50)
        at org.activiti.engine.impl.juel.AstNode.getValue(AstNode.java:26)
        at org.activiti.engine.impl.juel.TreeValueExpression.getValue(TreeValueExpression.java:114)
        at org.activiti.engine.impl.delegate.ExpressionGetInvocation.invoke(ExpressionGetInvocation.java:33)
        at org.activiti.engine.impl.delegate.DelegateInvocation.proceed(DelegateInvocation.java:37)
        at org.activiti.engine.impl.delegate.DefaultDelegateInterceptor.handleInvocation(DefaultDelegateInterceptor.java:25)
        at org.activiti.engine.impl.el.JuelExpression.getValue(JuelExpression.java:50)

I have assigned task fields in this way.
    <userTask id="gnHumanTask" name="Erm HumanTask" activiti:candidateGroups="BRMManager">
      <extensionElements>
        <activiti:formProperty id="Id" name=" Id" type="string" expression="#{taskPayloadData.processPayload.id}" writable="true"></activiti:formProperty>
          —–

Using client program I have created a process and  process is created with user task.
  Here is sample program for invoking process
   PayloadRequest processPaylaod = new PayloadRequest ();
      processPaylaod.setId(1001);
               ———–
  Map<String, Object> payloadRequest = new HashMap<String, Object>();
         payloadRequest.put("taskPayloadData", processPaylaod);
         ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(
               "brmQueueProcess",payloadRequest);

  Using the above java code, able to invoke instance and task is getting created and able to see the tasks in explorer.

But when trying to retrieve tasks using rest api getting the above exception. how to resolve the above issue?
5 REPLIES 5

trademak
Star Contributor
Star Contributor
Hi,

Did you also add the PayloadRequest class to the classpath of the Activiti REST web application?

Best regards,

ganeshr
Champ in-the-making
Champ in-the-making
Yes I have added all the dependant classes to activiti-explorer and activiti-rest classpath.

trademak
Star Contributor
Star Contributor
Your expression is not correct:

taskPayloadData.processPayload.id

should be:

taskPayloadData.id

Do you get a task form in the Activiti Explorer? With a value in the id form field?

Best regards,

ganeshr
Champ in-the-making
Champ in-the-making
actually i have given example for setting id value in client program..its a sample not the exact one..
PayloadRequest processPaylaod = new PayloadRequest ();
  processPaylaod.setId(1001);

PayloadRequest has variable with name processPayload(another pojo object). In my client program to invoke the process I'm using as below
PayloadRequest requestPaylaod = new PayloadRequest ();
  processPaylaod.getProcessPayload().setId(1001);

Yes task form is created in activiti explorer with the values I have used while invoking process instance.

trademak
Star Contributor
Star Contributor
That makes it a bit difficult to respond if I don't see the code that you are actually using.
Did you check if the database contains a record with the taskPayloadData variable? (ACT_RU_VARIABLE)
Are you sure that both the Explorer and REST web applications point to the same database?

Best regards,