diff --git a/process/Bulkmail_lib/process.js b/process/Bulkmail_lib/process.js index da334e18d5289ef99c6574daef1006cf9ed8b858..2140900b9671a57e923d57f3d1d3e08f7f9cb4ba 100644 --- a/process/Bulkmail_lib/process.js +++ b/process/Bulkmail_lib/process.js @@ -673,10 +673,16 @@ BulkMailUtils.startBulkmailWorkFlow = function(pMailLogId, pLinkId) .from("WEBLINK") .where("WEBLINK.WEBLINKID", pLinkId) .arrayRow(); - + + var contactId = newSelect("CONTACT_ID") + .from("MAIL_LOG") + .where("MAIL_LOG.MAIL_LOGID", pMailLogId) + .cell(); + var variables = { "mailLogId": pMailLogId, - "linkId": pLinkId + "linkId": pLinkId, + "contactId": contactId }; if (actionType == $KeywordRegistry.weblinkActionType$startWorkflow() && workflowKey) { diff --git a/process/SetCommunicationSetting_workflowService/SetCommunicationSetting_workflowService.aod b/process/SetCommunicationSetting_workflowService/SetCommunicationSetting_workflowService.aod index ded82a9d7a27ef0c55d1456a27778be078d51da5..cec630dd26074c0e0a1d1f60e3b07537cf8a2886 100644 --- a/process/SetCommunicationSetting_workflowService/SetCommunicationSetting_workflowService.aod +++ b/process/SetCommunicationSetting_workflowService/SetCommunicationSetting_workflowService.aod @@ -4,6 +4,7 @@ <majorModelMode>DISTRIBUTED</majorModelMode> <process>%aditoprj%/process/SetCommunicationSetting_workflowService/process.js</process> <alias>Data_alias</alias> + <serviceTaskParameterProcess>%aditoprj%/process/SetCommunicationSetting_workflowService/serviceTaskParameterProcess.js</serviceTaskParameterProcess> <variants> <element>WORKFLOW</element> </variants> diff --git a/process/SetCommunicationSetting_workflowService/process.js b/process/SetCommunicationSetting_workflowService/process.js index 8aa215483ef3c55f38b6b7eee051a878790e5a7e..8d65044041785ad522e9bd51863e7cc0e537d93a 100644 --- a/process/SetCommunicationSetting_workflowService/process.js +++ b/process/SetCommunicationSetting_workflowService/process.js @@ -6,16 +6,32 @@ import("system.vars"); var variables = JSON.parse(vars.get("$local.value")); var contactId = variables.contactId || variables.targetId; var channelType = variables.channelType; -var channelId = variables.channelId; +var medium = variables.medium || ""; +var channelId = variables.channelId || ""; var status = variables.status || $KeywordRegistry.communicationSettingStatus$rejected(); -var settingsId = newSelect("COMMUNICATIONSETTINGSID") +var settingsIdSql = newSelect("COMMUNICATIONSETTINGSID") .from("COMMUNICATIONSETTINGS") .where("COMMUNICATIONSETTINGS.CONTACT_ID", contactId) - .and("COMMUNICATIONSETTINGS.CHANNEL_TYPE", channelType) - .and("COMMUNICATIONSETTINGS.CHANNEL_ID", channelId) - .cell(); - + .and("COMMUNICATIONSETTINGS.CHANNEL_TYPE", channelType); + +if (medium) +{ + settingsIdSql.and("COMMUNICATIONSETTINGS.MEDIUM", medium); +} +else +{ + settingsIdSql.and("COMMUNICATIONSETTINGS.MEDIUM is null"); +} +if (channelId) +{ + settingsIdSql.and("COMMUNICATIONSETTINGS.CHANNEL_ID", channelId); +} +else +{ + settingsIdSql.and("COMMUNICATIONSETTINGS.CHANNEL_ID is null"); +} + if (settingsId) { newWhere("COMMUNICATIONSETTINGS.COMMUNICATIONSETTINGSID") diff --git a/process/SetCommunicationSetting_workflowService/serviceTaskParameterProcess.js b/process/SetCommunicationSetting_workflowService/serviceTaskParameterProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..3b4e5b8a16918ac0ef83380957b3b5b2248443b0 --- /dev/null +++ b/process/SetCommunicationSetting_workflowService/serviceTaskParameterProcess.js @@ -0,0 +1,15 @@ +import("KeywordRegistry_basic"); +import("system.result"); +import("KeywordData_lib"); +import("Workflow_lib"); + +result.object([ + new WorkflowServiceTaskParameter("channelType", "Channel type", WorkflowServiceTaskParameter.ENUM(), _getKeywords($KeywordRegistry.communicationChannelType())), + new WorkflowServiceTaskParameter("medium", "Medium", WorkflowServiceTaskParameter.ENUM(), _getKeywords($KeywordRegistry.communicationMediumCampaign())), + new WorkflowServiceTaskParameter("status", "Status", WorkflowServiceTaskParameter.ENUM(), _getKeywords($KeywordRegistry.communicationSettingStatus())) +]); + +function _getKeywords (pContainer) +{ + return KeywordData.getSimpleData(pContainer).map(function (item) {return {id : item[0], name : item[1]};}); +} \ No newline at end of file