Skip to content
Snippets Groups Projects
Commit ce6de6dc authored by Sebastian Listl's avatar Sebastian Listl :speech_balloon:
Browse files

#1065236 marketing automation workflow

parent 8fcd36c7
No related branches found
No related tags found
No related merge requests found
Showing
with 142 additions and 9 deletions
......@@ -121,6 +121,12 @@
<iconId>VAADIN:BAN</iconId>
<tooltipProcess>%aditoprj%/entity/BulkMailRecipient_entity/entityfields/recipientactions/children/removewithcommrestriction/tooltipProcess.js</tooltipProcess>
</entityActionField>
<entityActionField>
<name>startMarketingWorkflows</name>
<title>Start marketing workflow</title>
<onActionProcess>%aditoprj%/entity/BulkMailRecipient_entity/entityfields/recipientactions/children/startmarketingworkflows/onActionProcess.js</onActionProcess>
<isObjectAction v="false" />
</entityActionField>
</children>
</entityActionGroup>
<entityField>
......
import("Util_lib");
import("system.entities");
import("Context_lib");
import("system.vars");
import("system.neon");
var rows = vars.get("$sys.selectionRows");
var filter = vars.get("$sys.filter").filter;
var targets = [];
if (Utils.isNullOrEmpty(rows))
{
let loadConfig = entities.createConfigForLoadingRows()
.entity("BulkMailRecipient_entity")
.provider("BulkMailRecipients")
.fields(["CONTACT_ID", "TARGETCONTEXT"])
.addParameter("BulkMailId_param", vars.get("$param.BulkMailId_param"));
if (filter)
loadConfig.filter(JSON.stringify(filter));
rows = entities.getRows(loadConfig);
}
rows = rows.map(function (row)
{
return [row["CONTACT_ID"], row["TARGETCONTEXT"]];
});
neon.openContext("MarketingWorkflowLauncher", "MarketingWorkflowLauncherEdit_view", null, neon.OPERATINGSTATE_VIEW, {
"ObjectIds_param": JSON.stringify(rows),
"ObjectType_param": ContextUtils.getCurrentContextId()
});
\ No newline at end of file
......@@ -177,6 +177,12 @@
<tooltip>Update campaign step</tooltip>
<tooltipProcess>%aditoprj%/entity/CampaignParticipant_entity/entityfields/filterviewactiongroup/children/setsteptoparticipantselection/tooltipProcess.js</tooltipProcess>
</entityActionField>
<entityActionField>
<name>startMarketingWorkflows</name>
<title>Start marketing workflow</title>
<onActionProcess>%aditoprj%/entity/CampaignParticipant_entity/entityfields/filterviewactiongroup/children/startmarketingworkflows/onActionProcess.js</onActionProcess>
<isObjectAction v="false" />
</entityActionField>
</children>
</entityActionGroup>
<entityField>
......
import("Util_lib");
import("system.entities");
import("Context_lib");
import("system.vars");
import("system.neon");
var rows = vars.get("$sys.selectionRows");
var filter = vars.get("$sys.filter").filter;
var targets = [];
if (Utils.isNullOrEmpty(rows))
{
let loadConfig = entities.createConfigForLoadingRows()
.entity("CampaignParticipant_entity")
.provider("CampaignParticipantsProvider")
.fields(["CONTACT_ID", "CONTACTCONTEXT"])
.addParameter("CampaignId_param", vars.get("$param.CampaignId_param"))
.addParameter("CampaignStepId_param", vars.get("$param.CampaignStepId_param"))
.addParameter("ContactId_param", vars.get("$param.ContactId_param"));
if (filter)
loadConfig.filter(JSON.stringify(filter));
rows = entities.getRows(loadConfig);
}
rows = rows.map(function (row)
{
return [row["CONTACT_ID"], row["CONTACTCONTEXT"]];
});
neon.openContext("MarketingWorkflowLauncher", "MarketingWorkflowLauncherEdit_view", null, neon.OPERATINGSTATE_VIEW, {
"ObjectIds_param": JSON.stringify(rows),
"ObjectType_param": ContextUtils.getCurrentContextId()
});
\ No newline at end of file
......@@ -321,6 +321,7 @@
<entityConsumer>
<name>DocumentTemplatePlaceOfUse</name>
<stateProcess>%aditoprj%/entity/DocumentTemplate_entity/entityfields/documenttemplateplaceofuse/stateProcess.js</stateProcess>
<onValidation>%aditoprj%/entity/DocumentTemplate_entity/entityfields/documenttemplateplaceofuse/onValidation.js</onValidation>
<dependency>
<name>dependency</name>
<entityName>DocumentTemplatePlaceOfUse_entity</entityName>
......
import("system.translate");
import("system.result");
import("system.vars");
import("Entity_lib");
var usages = EntityConsumerRowsHelper.getCurrentConsumerRows("DocumentTemplatePlaceOfUse", ["PLACEOFUSE"]);
var hasMarketingWorkflowUsage = usages.some(function (usage)
{
return usage["PLACEOFUSE"] == "MarketingWorkflowLauncher";
});
if (hasMarketingWorkflowUsage && !vars.get("$field.Content").includes("{@workflowActionLink@}"))
{
result.string(translate.text("The template must contain the placeholder for the worklow-link to use it with the marketing workflow"));
}
......@@ -80,6 +80,7 @@
<recordContainers>
<datalessRecordContainer>
<name>dataLess</name>
<alias>Data_alias</alias>
</datalessRecordContainer>
</recordContainers>
</entity>
......@@ -2,6 +2,6 @@ import("system.vars");
import("system.result");
var variables = {
documentTemplate: vars.get("$field.DOCUMENTTEMPLATE_ID")
documentTemplateId: vars.get("$field.DOCUMENTTEMPLATE_ID")
};
result.string(JSON.stringify(variables));
\ No newline at end of file
import("Util_lib");
import("system.vars");
import("system.result");
import("FilterViewAction_lib");
var context = vars.get("$param.ObjectType_param");
var targets = Utils.parseJSON(vars.get("$param.ObjectIds_param")) || [];
targets = targets.map(function (targetId)
var targets = Utils.parseJSON(vars.get("$param.ObjectIds_param"));
var filter = Utils.parseJSON(vars.get("$param.ObjectFilter_param"));
targets = FilterViewActionUtils.getUidsBySelectionOrFilter(context, targets, filter).map(function (targetId)
{
if (Utils.isString(targetId))
return [targetId, context]; //todo: context dynamic (eg for participants)
return targetId;
});
result.string(JSON.stringify(targets));
\ No newline at end of file
......@@ -1422,6 +1422,18 @@
<fieldName>FilterProvider</fieldName>
</dependency>
</entityConsumer>
<entityActionGroup>
<name>workflowActions</name>
<title>Workflow</title>
<children>
<entityActionField>
<name>startMarketingWorkflows</name>
<title>Start marketing workflow</title>
<onActionProcess>%aditoprj%/entity/Organisation_entity/entityfields/workflowactions/children/startmarketingworkflows/onActionProcess.js</onActionProcess>
<isObjectAction v="false" />
</entityActionField>
</children>
</entityActionGroup>
</entityFields>
<recordContainers>
<dbRecordContainer>
......
import("Context_lib");
import("system.vars");
import("system.neon");
neon.openContext("MarketingWorkflowLauncher", "MarketingWorkflowLauncherEdit_view", null, neon.OPERATINGSTATE_VIEW, {
"ObjectIds_param": JSON.stringify(vars.get("$sys.selection")),
"ObjectFilter_param": JSON.stringify(vars.get("$sys.filter")),
"ObjectType_param": ContextUtils.getCurrentContextId()
});
\ No newline at end of file
......@@ -1103,7 +1103,7 @@
</entityActionField>
<entityActionField>
<name>startMarketingWorkflows</name>
<title>Marketing Workflow</title>
<title>Start marketing workflow</title>
<onActionProcess>%aditoprj%/entity/Person_entity/entityfields/filterviewactiongroup/children/startmarketingworkflows/onActionProcess.js</onActionProcess>
<isObjectAction v="false" />
</entityActionField>
......
......@@ -4,5 +4,6 @@ import("system.neon");
neon.openContext("MarketingWorkflowLauncher", "MarketingWorkflowLauncherEdit_view", null, neon.OPERATINGSTATE_VIEW, {
"ObjectIds_param": JSON.stringify(vars.get("$sys.selection")),
"ObjectFilter_param": JSON.stringify(vars.get("$sys.filter")),
"ObjectType_param": ContextUtils.getCurrentContextId()
});
\ No newline at end of file
......@@ -30,9 +30,9 @@ if (entityData["FORMRESULT"])
else
{
var params = {
"TaskTitle_param" : rowData["NAME"]
"TaskTitle_param": entityData["NAME"]
};
//if you try to open the task now, it will display "Task done"
neon.openContext("WorkflowTask", "WorkflowTaskPreview_view", [rowData["UID"]], neon.OPERATINGSTATE_VIEW, params);
neon.openContext("WorkflowTask", "WorkflowTaskPreview_view", [entityData["UID"]], neon.OPERATINGSTATE_VIEW, params);
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<neonContext xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonContext/1.1.1">
<name>MarketingWorkflowLauncher</name>
<title>f</title>
<title>Marketing workflow</title>
<majorModelMode>DISTRIBUTED</majorModelMode>
<entity>MarketingWorkflowLauncher_entity</entity>
<references>
......
......@@ -51,6 +51,7 @@
<name>Organisations</name>
<favoriteActionGroup1>filterViewActionGroup</favoriteActionGroup1>
<favoriteActionGroup2>DuplicateActions</favoriteActionGroup2>
<favoriteActionGroup3>workflowActions</favoriteActionGroup3>
<subtitleField>CUSTOMERCODE_DISPLAY_fieldGroup</subtitleField>
<entityField>#ENTITY</entityField>
<linkedColumns>
......@@ -100,6 +101,7 @@
<name>Treetable</name>
<favoriteActionGroup1>filterViewActionGroup</favoriteActionGroup1>
<favoriteActionGroup2>DuplicateActions</favoriteActionGroup2>
<favoriteActionGroup3>workflowActions</favoriteActionGroup3>
<entityField>#ENTITY</entityField>
<linkedColumns>
<element>NAME</element>
......
......@@ -23,6 +23,10 @@
<name>14de7f56-44cf-4c9e-89a7-59f84e482fd9</name>
<entityField>NAME</entityField>
</entityFieldLink>
<entityFieldLink>
<name>fd4252cf-e137-4068-a91b-732708f5ee1c</name>
<entityField>workflowTargets</entityField>
</entityFieldLink>
</fields>
</genericViewTemplate>
<dynamicFormViewTemplate>
......
......@@ -52,7 +52,10 @@ FilterViewActionUtils.getUidsByEntityFilter = function (pContext, pFilter)
var loadRowsConfig = entities.createConfigForLoadingRows()
.entity(ContextUtils.getEntity(pContext))
.fields(["#UID"])
.filter(JSON.stringify(pFilter.filter || pFilter));
if (pFilter.filter)
loadRowsConfig.filter(JSON.stringify(pFilter.filter));
else if (pFilter)
loadRowsConfig.filter(JSON.stringify(pFilter));
return entities.getRows(loadRowsConfig).map(function (row)
{
......
......@@ -10,7 +10,7 @@ import("Workflow_lib");
var processInstanceId = vars.get("$local.uid");
var variables = JSON.parse(vars.get("$local.value"));
var recipientContactId = variables.recipientContactId;
var recipientContactId = variables.recipientContactId || variables.targetId;
var documentTemplateId = variables.documentTemplateId;
var senderName = variables.senderName;
var mailSubject = variables.mailSubject;
......
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