cancel
Showing results for 
Search instead for 
Did you mean: 

Not able to get task form propery values in TaskListner

bhupendra1
Champ in-the-making
Champ in-the-making
Hi,

I am using Activiti 5.10 version. I have user task defined with form.
I want to capture the task from values in my task listner associated with this task, so that i can save those values in database.
I am using below code to get the task form property values.
(User is providing inputs to the fields in task and then on completion of task , task listener is invoked.)
This is returning correct names of the task form properties but it is returning the values as null. Please suggest. Thanks!

   public void notify(DelegateTask task) {
      ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();

            FormService formservice=processEngine.getFormService();
   
         System.out.println("Task Id : " + task.getId());
      System.out.println("Process def Id : " + task.getProcessDefinitionId());
   
      
      TaskFormData   taskFormdata  =formservice.getTaskFormData(task.getId());
      List<FormProperty> formList= taskFormdata.getFormProperties();
      for(int i=0;i<formList.size();i++){
         
         System.out.println( "Name: "  + formList.get(i).getName() +" Value is " + formList.get(i).getValue());
      }
      
   }
8 REPLIES 8

bhupendra1
Champ in-the-making
Champ in-the-making
Hi All,

Please provide hints on this if anyone has faced similar situation. Thanks!

jbarrez
Star Contributor
Star Contributor
The form values are saved to your process as process variables. Try to fetch the variable value, instead of using the form service.

bhupendra1
Champ in-the-making
Champ in-the-making
Thanks!

I tried to retirve a form values associated with task using exeuction like below, but it is still null.

task.getExecution().getVariable("Name"));

any thoughts?

jbarrez
Star Contributor
Star Contributor
ok, then something probably is wrong when you save the form.

How do you pass the form values/variables to the activiti engine?

bhupendra1
Champ in-the-making
Champ in-the-making
When user opens the task, he is presented with fields(these are from the form associated with task).
He fills in the fields and complete the task.
On completion of the task, I am invoking the Tasklistner and in that Tasklistner  i am tyring to fetch the form values which are
filled by user. The code which i pasted in first post is able to get the form names correclty but it seems that its not pickuping the updated values of the form fields. Seems to be bug to me but not sure.
Any idean what can be done here.

Thanks for your help!

jbarrez
Star Contributor
Star Contributor
Mmm could you reproduce it with a very simple process (one task) and simple form, and create a Jira for it? That would help me getting to the issue real quick.

bhupendra1
Champ in-the-making
Champ in-the-making
Hi,

I have creted Jira and attached sample process to it, Please find below the link

ACT-1376 - Not able to get Task form related values in Tasklistner

Thanks!

bhupendra1
Champ in-the-making
Champ in-the-making
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.