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

WorkflowTask open next task after completion

parent 7fd97d8f
No related branches found
No related tags found
No related merge requests found
import("system.result");
import("Context_lib");
import("system.vars");
import("system.project");
//import("system.result");
//import("Context_lib");
//import("system.vars");
//import("system.project");
var context = project.getContextStructure(vars.get("$field.TARGET_CONTEXT"));
result.string(ContextUtils.loadContentTitle(context.entity, vars.get("$field.TARGET_ID")));
//var context = project.getContextStructure(vars.get("$field.TARGET_CONTEXT"));
//
//result.string(ContextUtils.loadContentTitle(context.entity, vars.get("$field.TARGET_ID")));
import("system.neon");
import("system.workflow");
import("system.vars");
......@@ -14,5 +15,33 @@ vars.get("$local.changed").forEach(function (field)
break;
case "FORMRESULT.value":
workflow.completeTaskWithFormData(taskId, JSON.parse(value));
_openNextTaskIfExists(rowData["PROCESSINSTANCE_ID.value"], rowData["CREATE_TIME.value"]);
}
});
\ No newline at end of file
});
/*
* checks if a new task has been created for that process instance,
* if that's the case the new task will be opened
*/
function _openNextTaskIfExists (pProcessInstanceId, pCreateTime)
{
var loadConfig = workflow.createConfigForLoadingTasks()
.processInstanceId(pProcessInstanceId);
var startVal = {
id : null,
createTime : new Date(+pCreateTime).toString()
};
var newestTask = JSON.parse(workflow.getTasks(loadConfig)).reduce(function (prev, curr)
{
var prevTime = Date.parse(prev.createTime);
var currTime = Date.parse(curr.createTime);
return prevTime > currTime ? prev : curr;
}, startVal);
if (newestTask.id !== null)
{
neon.openContext("WorkflowTask", "WorkflowTaskPreview_view", [newestTask.id], neon.OPERATINGSTATE_VIEW, null);
}
}
\ No newline at end of file
......@@ -77,8 +77,8 @@
<entityField>PROBABILITY</entityField>
</entityFieldLink>
<entityFieldLink>
<name>3317b73e-68e8-41a8-a678-89c7c7c8513e</name>
<entityField>SALESPROJECT_ID</entityField>
<name>c603a596-a305-4408-8918-90e6e2a49ca1</name>
<entityField>OBJECT_ROWID</entityField>
</entityFieldLink>
<entityFieldLink>
<name>59daee43-0e79-49d8-a36a-5ce4c491def9</name>
......
......@@ -2,6 +2,7 @@
<neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.3" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.3">
<name>WorkflowTaskPreview_view</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<isSmall v="true" />
<layout>
<headerFooterLayout>
<name>layout</name>
......
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