How to access the outcome of a review task in TaskListener?

cancel
Showing results for 
Search instead for 
Did you mean: 
paiyyavj13
Established Member II

How to access the outcome of a review task in TaskListener?

Jump to solution

I have a user review task (which is parallel and Multi-instance type), which has custom form in Activiti with custom outcomes (Approve and Reject)... once the task gets completed, I want to know the form variable into which the task outcome is stored... I believe it is one of the task variables.... I want to access it in a Java Task Listener on task complete... please guide... 

1 Solution

Accepted Solutions
cjose
Senior Member II

Re: How to access the outcome of a review task in TaskListener?

Jump to solution

As Greg mentioned, the outcome is saved as a process variable form<formid>outcome. However when you have a multi-instance scenario it could get overwritten every time. So it is better not to rely on the process variable if you want to find the selected outcome. You would be better of using the 

submittedFormService bean which will use the outcome data from each submittedForms associated with the individual tasks. Please find attached an example on how to achieve this with a Delegate.

Cheers,

Ciju

View solution in original post

3 Replies
gdharley
Intermediate

Re: How to access the outcome of a review task in TaskListener?

Jump to solution

Custom outcomes are written into the process as process variables with a variable name of:

form<formid>outcome

e.g. form10001outcome = bogus

The variable will have a value of the outcome you have chosen.

I am not exactly sure what happens if the same form is reused in multiple tasks, since it appears to be the primary key of the form table that is included in the id of the variable.

Custom outcomes are very useful but not well documented unfortunately.

Greg

cjose
Senior Member II

Re: How to access the outcome of a review task in TaskListener?

Jump to solution

As Greg mentioned, the outcome is saved as a process variable form<formid>outcome. However when you have a multi-instance scenario it could get overwritten every time. So it is better not to rely on the process variable if you want to find the selected outcome. You would be better of using the 

submittedFormService bean which will use the outcome data from each submittedForms associated with the individual tasks. Please find attached an example on how to achieve this with a Delegate.

Cheers,

Ciju

rahiakela
Active Member II

Re: How to access the outcome of a review task in TaskListener?

Jump to solution

Hi,

I have used your implemented code but I am getting the below error.

When I add the capability "Administration of tenant of this group"  to respective user then it works. but I don't want to give this capability  to the user due to some company's policy.

Please help me how should I resolve it ?

Thanks

Rahi