// get the process instance
long processInstance = getWorkflowService().getProcessInstanceIdForTaskInstance(taskInstanceId);
// then we get the user id
Long userId = (Long) getWorkflowService().getProcessVariable(processInstance, "userId");
User user = getUserManagmentService().getUserById(userId);
log.info ( "SendConfirmationEmail userId:"+ userId) ;
if (user != null) {
String email = user.getEmail();
EmailUtils emailUtils = (EmailUtils) getApplicationContext().getBean("emailUtils");
Map<String, String> tpl = loadTemplate("confirmation_email");
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("user", user);
String uidHash = getUserManagmentService().getHashForUser(user.getId());
parameters.put("userIdHash", uidHash);
emailUtils.sendEmailMessage("theteam@theteam.com", new String[]{email}, tpl.get("subject"), tpl.get(TXT_KEY), tpl.get(HTML_KEY), parameters);
getWorkflowService().completeTaskInstance(taskInstanceId);
}