cancel
Showing results for 
Search instead for 
Did you mean: 

getting formalExpression value from userTask

franklin
Champ in-the-making
Champ in-the-making
Hi all,

Is it possible to get the formalExpression value from Task object?

This is the example:

   <userTask  id="sid-F9D4084B-39BF-4859-B3CA-16E5D692C69F"
         name="Aprovar solicitacao" startQuantity="1">
         <extensionElements>
            <signavio:signavioMetaData metaKey="bgcolor" metaValue="#ffffcc"/>
         </extensionElements>
         <incoming>sid-3E58DA18-10EF-4BF0-9442-584C749AF38E</incoming>
         <outgoing>sid-D9831DE0-77C0-4761-A334-5A6877FC1C37</outgoing>
          <potentialOwner>
              <resourceAssignmentExpression>
                <formalExpression>0103</formalExpression>
              </resourceAssignmentExpression>
         </potentialOwner>
      </userTask>

How can I get the 0103 value?

Thank you all.
3 REPLIES 3

trademak
Star Contributor
Star Contributor
Hi,

Can you elaborate a bit more about what you want to do with this?
Maybe a Task Listener could help with a field expression.

Best regards,

franklin
Champ in-the-making
Champ in-the-making
Hi trademark.
Sorry, let me try again…

I have in my process two User Tasks.

When the complete event finish on the first one, the activiti engine automatically create a new task without assignee.
This task represent the second task.

My doubt come from this point.

How can and what is the best way to assign user or groups to the second task?

In my case, the formalExpression of second task contains the 0103 value representing my user group.

<potentialOwner>
<resourceAssignmentExpression>
<formalExpression>0103</formalExpression>
</resourceAssignmentExpression>
</potentialOwner>

Today I getting this task using this code.
Task t = this.taskService.createTaskQuery().taskCandidateGroup(groupValue).singleResult();

Is this correct? There is another way to do this?
Trying another way, I install a task listener in second task on create event. When it is called, I do all necessary assignments to the
task.

The general ideia is:
When activiti create the second task, it will automatically read the formalExpression of this task and make all necessary assignments.

Thank's for fast reply.

Best regards,

Franklin

jbarrez
Star Contributor
Star Contributor
To get the formal expression you will have to do some serious casting. The expression is saved in the internals of the ProcessDefinition object.