Skip to content
Snippets Groups Projects
Commit 7071e369 authored by S.Listl's avatar S.Listl
Browse files

Workflow optimizations

parent 0386615b
No related branches found
No related tags found
No related merge requests found
......@@ -8,7 +8,6 @@ import("Workflow_lib");
import("system.vars");
import("system.workflow");
var workflowDefId = vars.get("$param.WorkflowDefinitionId_param");
var isOnlyForCurrentUser = vars.get("$param.OnlyForCurrentUser_param") == "true";
var loadConfig = workflow.createConfigForLoadingTasks();
......@@ -20,13 +19,11 @@ if (vars.get("$local.idvalues") && vars.get("$local.idvalues")[0])
.taskId(vars.get("$local.idvalues")[0])
tasks = [JSON.parse(workflow.getTask(loadConfig))];
}
else if (isOnlyForCurrentUser)
{
loadConfig.candidateIdentifier(EmployeeUtils.getCurrentUserId());
}
if (!tasks)
else {
if (isOnlyForCurrentUser)
loadConfig.candidateIdentifier(EmployeeUtils.getCurrentUserId());
tasks = JSON.parse(workflow.getTasks(loadConfig));
}
tasks = tasks.map(function (task)
{
......
......@@ -4,8 +4,6 @@ import("ActivityTask_lib");
var variables = JSON.parse(vars.get("$local.value"));
//params: subject, content, entrydate, links, category, direction, responsible
var activityData = {
responsibleContactId : variables.activityResponsible,
directionKeywordId : variables.activityDirection,
......@@ -16,7 +14,7 @@ var activityData = {
userNew : variables.USER_ID
};
var links = null;
var links = [[variables.targetContext, variables.targetId]];
var activity = ActivityUtils.insertNewActivity(activityData, links);
result.string(activity.activityId);
......
import("system.logging");
import("system.vars");
import("system.notification");
var variables = JSON.parse(vars.get("$local.value"));
//params: notificationIcon, notificationCaption, notificationDescription, notificationUsers, link
logging.log(JSON.stringify(variables, null, "\t"))
var config = notification.createConfig()
.notificationType("WorkflowNotification")
.addUsersWithIds([variables.notificationUsers || variables.USER_ID])
......
......@@ -5,8 +5,6 @@ import("Email_lib");
var variables = JSON.parse(vars.get("$local.value"));
//params: sender, documenttemplateid, recipientContactId
var email = Email.fromTemplate(variables.documentTemplateId, variables.recipientContactId);
var sendResult = email.send();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment