Get user assigned to a task
Hi,
In the Studio, you will find pre-defined variables. Among them, you'll see the taskAssigneeId.
To retrieve the professional email for the assignee in a groovy script, you could proceed with something like that:
// Start code
import org.bonitasoft.engine.identity.User;
import org.bonitasoft.engine.identity.ContactData;
import org.bonitasoft.engine.identity.UserWithContactData;
import java.util.logging.Logger;
Logger logger = Logger.getLogger("org.bonitasoft");
final UserWithContactData assigneeWithProfessionalDetails = apiAccessor.identityAPI.getUserWithProfessionalDetails(taskAssigneeId);
ContactData assigneeContactData = assigneeWithProfessionalDetails.getContactData();
String assigneeProfessionalEmail = assigneeContactData.getEmail();
logger.info("Assignee Professional Email is: " + assigneeProfessionalEmail);
return assigneeProfessionalEmail;
// End code
I invite you to consult the Javadoc for the identity API here: https://documentation.bonitasoft.com/javadoc/api/7.10/org/bonitasoft/engine/identity/UserWithContactData.html
I hope it helps,
Regards,
Marielle
Comments
hi, thanks for your replay,
taskAssigneeId is not known;
my screenplay,
I have a task (prepare coffee) , this task is connected to timer, and a service type task to send a mail to the person assigned to the task (prepare coffee) to tell him that you are assigned to the task (prepare coffee).
what I'm trying to do is, to get the user assigned to task (prepare coffée) and send him an email
is there a way to find out who is assigned to a specific task with a groovy script:
Something like this:
..... getAssignedHumanTask ("HumanTask name",...)
Hi,
as there is a technical issue with this question and you can't see Marielle's answer, I will copy it in your other related question in french : https://community.bonitasoft.com/node/33437#node-33446