cancel
Showing results for 
Search instead for 
Did you mean: 

Specifying recipient of MailTask as a user's email attribute

asinoladro
Champ in-the-making
Champ in-the-making
Hello,

I have a BPMN flow which contains:

1. A UserTask where someone assigns a user to the process variable 'thirdParty', followed by
2. A MailTask that is supposed to send an email to the email address associated with the thirdParty user object, referring to them by name in the body of the email.

Why I want this: it seems messy and laborious (and not very OO) to carry around a set of process variables giving each property of a single user. Passing these into other flows via CallTask would also be a huge pain.

I tried just putting <activiti:field name="to"><activiti:expression>${thirdParty.email}</activiti:expression></activiti:field> (with ${thirdParty.name} embedded in the 'text' field), but I get an 'Unknown property' error.

Am I required to write a ServiceTask with custom code that takes in a process variable of type User and outputs several process variables? Or is there a more lightweight, out-of-the-box solution?

Thanks
Duncan.
1 REPLY 1

trademak
Star Contributor
Star Contributor
You can use the textVar property to make sure the expressions are resolved. It should be able to resolve the process variable values.

Best regards,