Get user assigned to a task

1
0
-1

hi all,

how can I get user assigned to a task with script groovy,

I want to get user to send an email to him, that his is assigned to a task,

i use email connector.

How can I do that with script groovy,

Thanks in advance

1 answer

1
+1
-1

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

Submitted by merikawasselin_... on Thu, 01/02/2020 - 07:09

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

Submitted by merikawasselin_... on Fri, 01/03/2020 - 06:28

is there a way to find out who is assigned to a specific task with a groovy script:

Something like this:

..... getAssignedHumanTask ("HumanTask name",...)

Submitted by delphine.coille... on Fri, 01/03/2020 - 16:39

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

Notifications