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

#1058714 Workflow forms with conditional fields

parent eab259cf
No related branches found
No related tags found
No related merge requests found
...@@ -27,9 +27,11 @@ ...@@ -27,9 +27,11 @@
</entityField> </entityField>
<entityField> <entityField>
<name>FORMDEFINITION</name> <name>FORMDEFINITION</name>
<valueProcess>%aditoprj%/entity/WorkflowTask_entity/entityfields/formdefinition/valueProcess.js</valueProcess>
</entityField> </entityField>
<entityField> <entityField>
<name>FORMRESULT</name> <name>FORMRESULT</name>
<onValueChange>%aditoprj%/entity/WorkflowTask_entity/entityfields/formresult/onValueChange.js</onValueChange>
</entityField> </entityField>
<entityField> <entityField>
<name>NAME</name> <name>NAME</name>
...@@ -257,9 +259,6 @@ ...@@ -257,9 +259,6 @@
<isFilterable v="true" /> <isFilterable v="true" />
<isLookupFilter v="true" /> <isLookupFilter v="true" />
</jDitoRecordFieldMapping> </jDitoRecordFieldMapping>
<jDitoRecordFieldMapping>
<name>FORMDEFINITION.value</name>
</jDitoRecordFieldMapping>
<jDitoRecordFieldMapping> <jDitoRecordFieldMapping>
<name>FORMRESULT.value</name> <name>FORMRESULT.value</name>
</jDitoRecordFieldMapping> </jDitoRecordFieldMapping>
......
import("system.result");
import("system.vars");
import("system.workflow");
import("system.neon");
//the value of this field can be set by the onValueChange process of FORMRESULT
if (vars.get("$this.value") == null)
result.string(workflow.getFormProperties(vars.get("$field.UID")));
\ No newline at end of file
import("system.result");
import("system.vars");
import("system.workflow");
import("system.neon");
var taskId = vars.get("$field.UID");
var newResult = vars.get("$local.value");
var oldResult = vars.get("$field.FORMRESULT");
if (newResult && newResult !== oldResult)
{
/*
* fieldListeners = all fields that are used inside a visibility expression
* -> if one of these fields is changed, set the new FORMDEFINITION
*/
var fieldListeners = JSON.parse(workflow.getFormFieldListeners(taskId));
newResult = newResult ? JSON.parse(newResult) : {};
oldResult = oldResult ? JSON.parse(oldResult) : {};
var isRefreshRequired = fieldListeners.some(function (fieldId)
{
return newResult[fieldId] !== oldResult[fieldId];
});
if (isRefreshRequired)
neon.setFieldValue("$field.FORMDEFINITION", workflow.getFormProperties(taskId, newResult));
}
\ No newline at end of file
...@@ -96,7 +96,6 @@ result.object((function () ...@@ -96,7 +96,6 @@ result.object((function ()
task.processDefinitionId, task.processDefinitionId,
task.processInstanceId, task.processInstanceId,
Date.parse(task.createTime).toString(), Date.parse(task.createTime).toString(),
workflow.getFormProperties(task.id) || "",
"", "",
variables.USER_ID || "", variables.USER_ID || "",
task.description || "", task.description || "",
......
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