03-06-2012 08:27 AM
03-06-2012 10:46 AM
ActionService actionService = getServiceRegistry().getActionService();
Action mailAction = actionService.createAction(MailActionExecuter.NAME);
mailAction.setParameterValue(MailActionExecuter.PARAM_SUBJECT, ExternalReviewNotification.SUBJECT);
mailAction.setParameterValue(MailActionExecuter.PARAM_TO, recipient);
mailAction.setParameterValue(MailActionExecuter.PARAM_FROM, ExternalReviewNotification.FROM_ADDRESS);
mailAction.setParameterValue(MailActionExecuter.PARAM_TEXT, sb.toString());
actionService.executeAction(mailAction, null);
If you want to use an FTL template for the email body, set PARAM_TEMPLATE to the node reference of the FTL template.05-14-2014 10:23 PM
03-07-2012 04:32 AM
ActionService actionService = serviceRegistry.getActionService();
Action mailAction = actionService.createAction(MailActionExecuter.NAME);
mailAction.setParameterValue(MailActionExecuter.PARAM_SUBJECT, subject);
mailAction.setParameterValue(MailActionExecuter.PARAM_TO, to);
mailAction.setParameterValue(MailActionExecuter.PARAM_FROM, from);
mailAction.setParameterValue(MailActionExecuter.PARAM_TEXT, body);
// Define Model
String templatePATH = "PATH:\"/app:company_home/app:dictionary/app:email_templates/cm:workflownotification/cm:wf-custom-remind.ftl\"";
ResultSet resultSet = serviceRegistry.getSearchService().query(new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore"), SearchService.LANGUAGE_LUCENE, templatePATH);
if (resultSet.length()==0){
logger.error("Template "+ templatePATH+" not found.");
return;
}
NodeRef template = resultSet.getNodeRef(0);
mailAction.setParameterValue(MailActionExecuter.PARAM_TEMPLATE, template);
// Define parameters for the model (set fields in the ftl like : args.workflowTitle)
Map<String, Serializable> templateArgs = new HashMap<String, Serializable>();
templateArgs.put("workflowTitle","a");
templateArgs.put("workflowPooled", false);
templateArgs.put("workflowPriority", 1);
templateArgs.put("workflowDescription", "d");
templateArgs.put("workflowId",1);
Map<String, Serializable> templateModel = new HashMap<String, Serializable>();
templateModel.put("args",(Serializable)templateArgs);
mailAction.setParameterValue(MailActionExecuter.PARAM_TEMPLATE_MODEL,(Serializable)templateModel);
actionService.executeAction(mailAction, null);
12-19-2013 12:47 AM
06-16-2014 11:16 AM
12-10-2014 01:24 PM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.