define(function (require) {
var Postmonger = require('postmonger');
var connection = new Postmonger.Session();
var payload = {};
var steps = [
{'key': 'eventdefinitionkey', 'label': 'Event Definition Key'}
];
//HERE it works
//connection.trigger('requestSchema');
var currentStep = steps[0].key;
var deName;
$(window).ready(function () {
connection.trigger('ready');
});
function initialize(data) {
if (data) {
payload = data;
}
}
function onClickedNext() { //SAVE USED HERE
if (currentStep.key === 'eventdefinitionkey') {
save();
} else {
connection.trigger('nextStep');
}
}
function onClickedBack () {
connection.trigger('prevStep');
}
function onGotoStep (step) {
showStep(step);
connection.trigger('ready');
}
function showStep (step, stepIndex) {
if (stepIndex && !step) {
step = steps[stepIndex - 1];
}
currentStep = step;
$('.step').hide();
switch (currentStep.key) {
case 'eventdefinitionkey':
$('#step1').show();
$('#step1 input').focus();
break;
}
}
function save() { //SAVE FUNCTION
console.log('save');
connection.trigger('requestSchema'); //NOT SHOWN IN CONSOLE
let campaignNameKey = $('#select-campaign-name').val();
let csvName = $('#select-csv-name').val();
console.log("DE NAME " + deName);
payload['arguments'] = payload['arguments'] || {};
payload['arguments'].execute = payload['arguments'].execute || {};
payload['arguments'].execute.inArguments = [{
'campaignNameKey': campaignNameKey,
'csvName': csvName,
"Prenom": "{{Contact.Attribute."+ deName +".[\"Prénom\"]}}",
"Nom": "{{Contact.Attribute." + deName +".Nom}}",
"Mobile": "{{Contact.Attribute." + deName +".Mobile}}",
"Campagne": "{{Contact.Attribute." + deName +".Campagne}}",
"stopSMS": "{{Contact.Attribute." + deName +".stopSMS}}"
}];
payload['metaData'] = payload['metaData'] || {};
payload['metaData'].isConfigured = true;
//console.log(JSON.stringify(payload));
connection.trigger('updateActivity', payload);
}
connection.on('requestedSchema', function (data) { //CONNECTION ON
// save schema
console.log('*** Schema ***', JSON.stringify(data['schema']));
let schema = JSON.stringify(data['schema']);
});
connection.on('initActivity', initialize);
connection.on('clickedNext', onClickedNext);
connection.on('clickedBack', onClickedBack);
connection.on('gotoStep', onGotoStep);
});
define(function (require) {
var Postmonger = require('postmonger');
var connection = new Postmonger.Session();
var payload = {};
var steps = [
{'key': 'eventdefinitionkey', 'label': 'Event Definition Key'}
];
//HERE it works
//connection.trigger('requestSchema');
var currentStep = steps[0].key;
var deName;
$(window).ready(function () {
connection.trigger('ready');
});
function initialize(data) {
if (data) {
payload = data;
}
}
function onClickedNext() { //SAVE USED HERE
if (currentStep.key === 'eventdefinitionkey') {
save();
} else {
connection.trigger('nextStep');
}
}
function onClickedBack () {
connection.trigger('prevStep');
}
function onGotoStep (step) {
showStep(step);
connection.trigger('ready');
}
function showStep (step, stepIndex) {
if (stepIndex && !step) {
step = steps[stepIndex - 1];
}
currentStep = step;
$('.step').hide();
switch (currentStep.key) {
case 'eventdefinitionkey':
$('#step1').show();
$('#step1 input').focus();
break;
}
}
function save() { //SAVE FUNCTION
console.log('save');
connection.trigger('requestSchema'); //NOT SHOWN IN CONSOLE
let campaignNameKey = $('#select-campaign-name').val();
let csvName = $('#select-csv-name').val();
console.log("DE NAME " + deName);
payload['arguments'] = payload['arguments'] || {};
payload['arguments'].execute = payload['arguments'].execute || {};
payload['arguments'].execute.inArguments = [{
'campaignNameKey': campaignNameKey,
'csvName': csvName,
"Prenom": "{{Contact.Attribute."+ deName +".[\"Prénom\"]}}",
"Nom": "{{Contact.Attribute." + deName +".Nom}}",
"Mobile": "{{Contact.Attribute." + deName +".Mobile}}",
"Campagne": "{{Contact.Attribute." + deName +".Campagne}}",
"stopSMS": "{{Contact.Attribute." + deName +".stopSMS}}"
}];
payload['metaData'] = payload['metaData'] || {};
payload['metaData'].isConfigured = true;
//console.log(JSON.stringify(payload));
connection.trigger('updateActivity', payload);
}
connection.on('requestedSchema', function (data) {
// save schema
console.log('*** Schema ***', JSON.stringify(data['schema']));
let schema = JSON.stringify(data['schema']);
});
connection.on('initActivity', initialize);
connection.on('clickedNext', onClickedNext);
connection.on('clickedBack', onClickedBack);
connection.on('gotoStep', onGotoStep);
});
define(function (require) {
var Postmonger = require('postmonger');
var connection = new Postmonger.Session();
var payload = {};
var steps = [
{'key': 'eventdefinitionkey', 'label': 'Event Definition Key'}
];
//HERE it works
//connection.trigger('requestSchema');
var currentStep = steps[0].key;
var deName;
$(window).ready(function () {
connection.trigger('ready');
});
function initialize(data) {
if (data) {
payload = data;
}
}
function onClickedNext() { //SAVE USED HERE
if (currentStep.key === 'eventdefinitionkey') {
save();
} else {
connection.trigger('nextStep');
}
}
function onClickedBack () {
connection.trigger('prevStep');
}
function onGotoStep (step) {
showStep(step);
connection.trigger('ready');
}
function showStep (step, stepIndex) {
if (stepIndex && !step) {
step = steps[stepIndex - 1];
}
currentStep = step;
$('.step').hide();
switch (currentStep.key) {
case 'eventdefinitionkey':
$('#step1').show();
$('#step1 input').focus();
break;
}
}
function save() { //SAVE FUNCTION
console.log('save');
connection.trigger('requestSchema'); //NOT SHOWN IN CONSOLE
let campaignNameKey = $('#select-campaign-name').val();
let csvName = $('#select-csv-name').val();
console.log("DE NAME " + deName);
payload['arguments'] = payload['arguments'] || {};
payload['arguments'].execute = payload['arguments'].execute || {};
payload['arguments'].execute.inArguments = [{
'campaignNameKey': campaignNameKey,
'csvName': csvName,
"Prenom": "{{Contact.Attribute."+ deName +".[\"Prénom\"]}}",
"Nom": "{{Contact.Attribute." + deName +".Nom}}",
"Mobile": "{{Contact.Attribute." + deName +".Mobile}}",
"Campagne": "{{Contact.Attribute." + deName +".Campagne}}",
"stopSMS": "{{Contact.Attribute." + deName +".stopSMS}}"
}];
payload['metaData'] = payload['metaData'] || {};
payload['metaData'].isConfigured = true;
//console.log(JSON.stringify(payload));
connection.trigger('updateActivity', payload);
}
connection.on('requestedSchema', function (data) { //CONNECTION ON
// save schema
console.log('*** Schema ***', JSON.stringify(data['schema']));
let schema = JSON.stringify(data['schema']);
});
connection.on('initActivity', initialize);
connection.on('clickedNext', onClickedNext);
connection.on('clickedBack', onClickedBack);
connection.on('gotoStep', onGotoStep);
});
EDIT : my customActivity.js
define(function (require) {
var Postmonger = require('postmonger');
var connection = new Postmonger.Session();
var payload = {};
var steps = [
{'key': 'eventdefinitionkey', 'label': 'Event Definition Key'}
];
"trigger": {
"id": {
"a": "521ea773-aa99-4755-a596-1b47621bf78d",
"b": null
},
"outcomes": {
"a": []
},
"metaData": {
"sourceInteractionId": {
"a": "00000000-0000-0000-0000-000000000000"
},
"scheduleState": {
"b": "No Schedule"
}
},
"documentArguments": {
"startActivityKey": {
"a": "{{Context.StartActivityKey}}"
},
"dequeueReason": {
"a": "{{Context.DequeueReason}}"
},
"lastExecutedActivityKey": {
"a": "{{Context.LastExecutedActivityKey}}"
},
"filterResult": {
"a": "true"
},
"serializedObjectType": {
"b": 3
},
"eventDefinitionId": {
"b": "eb788811-efee-41a2-8539-dd7cd3581808"
},
"eventDefinitionKey": {
"b": "DEAudience-8a4ce4c8-028d-24ec-13bc-99c56d23e3b2"
},
"dataExtensionId": {
"b": "78f14e04-7cb5-e711-80cf-1402ec819bf8"
},
"automationId": {
"b": "48247447-ca70-443e-b390-ac70cc01a326"
}
},
"schemaVersionId": {
"a": 0
},
"configurationArguments": {
"a": {
"filterDefinitionId": "00000000-0000-0000-0000-000000000000"
}
},
"eventDefinition": {
"deUsageDataReturned": {
"b": null
}
},
"mode": {
"b": "Production"
},
"isVisibleInPicker": {
"b": false
},
"interactionCount": {
"b": 2
},
"publishedInteractionCount": {
"b": 0
},
"dataExtensionId": {
"b": "78f14e04-7cb5-e711-80cf-1402ec819bf8"
},
"schema": {
"b": null
},
"createdDate": {
"b": "2018-06-11T05:43:36.180Z"
},
"createdBy": {
"b": 100125031
},
"modifiedBy": {
"b": 100125031
},
"dataExtensionName": {
"b": "Contacts"
},
"sourceApplicationExtensionId": {
"b": "a62ff9df-dc1c-4e9a-87cd-c05841d79f38"
},
"filterDefinitionTemplate": {
"b": ""
},
"category": {
"b": "Audience"
},
"automationId": {
"b": "48247447-ca70-443e-b390-ac70cc01a326"
},
"scheduleFlowMode": {
"b": "runOnce"
},
"runOnceScheduleMode": {
"b": "onPublish"
},
"unconfigured": {
"b": false
},
"_originalDeAudienceType": {
"b": "EmailAudience"
},
"config": {
"b": {
"internal": true,
"scheduleEnabled": true,
"scheduleTile": true,
"supportsAutomationSchedule": true,
"configurableHighWatermark": true,
"userInterfaces": {
"summary": [
{
"fieldName": "startDateTime",
"valuePath": "schedule.startDateTime",
"label": "Start",
"timezoneOffsetPath": "timezoneOffset",
"type": "date",
"momentFormat": "LLL"
},
{
"fieldName": "timeZone",
"valuePath": "schedule.timeZone",
"label": "Time Zone"
},
{
"fieldName": "frequency",
"valuePath": "schedule.frequency",
"label": "Repeat",
"valueInLang": true
},
{
"fieldName": "interval",
"valuePath": "schedule.interval",
"label": "Repeat Every"
},
{
"fieldName": "customDayOfTheWeek",
"valuePath": "schedule",
"label": "Day(s) of the Week"
},
{
"fieldName": "scheduledDay",
"valuePath": "schedule.scheduledDay",
"label": "Scheduled Day"
},
{
"fieldName": "scheduledDayOfWeek",
"valuePath": "schedule.scheduledDayOfWeek",
"label": "Scheduled Day of the Week",
"valueInLang": true
},
{
"fieldName": "scheduledMonth",
"valuePath": "schedule.scheduledMonth",
"label": "Scheduled Month",
"valueInLang": true
},
{
"fieldName": "scheduledWeek",
"valuePath": "schedule.scheduledWeek",
"label": "Scheduled Week",
"valueInLang": true
},
{
"fieldName": "endDateTime",
"valuePath": "schedule.endDateTime",
"label": "End",
"type": "date",
"momentFormat": "LL"
},
{
"fieldName": "occurrences",
"valuePath": "schedule.occurrences",
"label": "End"
},
{
"fieldName": "useHighWatermark",
"valuePath": "useHighWatermark",
"label": "Evaluate new records only"
},
{
"fieldName": "automationName",
"valuePath": "automation.name",
"label": "Automation Name"
},
{
"fieldName": "activityName",
"valuePath": "activityName",
"label": "Activity Name"
},
{
"fieldName": "deRecordCount",
"valuePath": "deRecordCount",
"label": "Record Count"
},
{
"fieldName": "fileTriggerActive",
"valuePath": "automation.fileTrigger.triggerActive",
"label": "File Trigger Active"
},
{
"fieldName": "fileTriggerFolder",
"valuePath": "automation.fileTrigger.folderLocationText",
"label": "File Trigger Directory"
},
{
"fieldName": "automationStatus",
"valuePath": "automation.status",
"label": "Automation Status"
}
]
},
"lang": {
"en-US": {
"never": "Never",
"hourly": "Hourly",
"daily": "Daily",
"weekly": "Weekly",
"monthly": "Monthly",
"yearly": "Yearly",
"sunday": "Sunday",
"monday": "Monday",
"tuesday": "Tuesday",
"wednesday": "Wednesday",
"thursday": "Thursday",
"friday": "Friday",
"saturday": "Saturday",
"First": "First",
"Second": "Second",
"Third": "Third",
"Fourth": "Fourth",
"Last": "Last",
"January": "January",
"February": "February",
"March": "March",
"April": "April",
"May": "May",
"June": "June",
"July": "July",
"August": "August",
"September": "September",
"October": "October",
"November": "November",
"December": "December",
"true": "Scheduled",
"00:00": "00:00",
"01:00": "01:00",
"02:00": "02:00",
"03:00": "03:00",
"04:00": "04:00",
"05:00": "05:00",
"06:00": "06:00",
"07:00": "07:00",
"08:00": "08:00",
"09:00": "09:00",
"10:00": "10:00",
"11:00": "11:00",
"12:00": "12:00",
"13:00": "13:00",
"14:00": "14:00",
"15:00": "15:00",
"16:00": "16:00",
"17:00": "17:00",
"18:00": "18:00",
"19:00": "19:00",
"20:00": "20:00",
"21:00": "21:00",
"22:00": "22:00",
"23:00": "23:00"
}
},
"entrySourceGroupConfigUrl": "jb:///data/entry/audience/"
}
},
"automation": {
"b": {
"id": "48247447-ca70-443e-b390-ac70cc01a326",
"name": "Test Activity Custom - 2018-06-11T074336.133",
"description": "Event Definition Automation",
"key": "10ed873f-26ab-47ac-a604-46e27c1fdfea",
"typeId": 1,
"type": "scheduled",
"statusId": 2,
"status": "Ready",
"categoryId": 11229,
"lastRunTime": "2018-06-18T08:04:27.667",
"lastRunInstanceId": "a366f85c-6ab0-428c-8481-e0c7b6e7eaa9",
"schedule": {
"scheduleStatus": "none"
},
"steps": [
{
"id": "5ea1a729-74dc-4652-9941-0847291f5279",
"name": "",
"description": "",
"step": 1,
"activities": [
{
"id": "a6a1cdd8-60f0-41f5-9204-3994e29731bf",
"name": "Contacts",
"activityObjectId": "eb788811-efee-41a2-8539-dd7cd3581808",
"objectTypeId": 952,
"displayOrder": 1
}
]
}
]
}
},
"deRecordCount": {
"b": 4
},
"deUsageDataReturned": {
"b": null
//HERE it works
//connection.trigger('requestSchema');
var currentStep = steps[0].key;
var deName;
$(window).ready(function () {
connection.trigger('ready');
});
function initialize(data) {
if (data) {
payload = data;
}
},
"mobileNumber":
function onClickedNext() { //SAVE USED HERE
"0":if (currentStep.key === 'eventdefinitionkey') {
"a":save(); "{
} else {Event.DEAudience-8a4ce4c8-028d-24ec-13bc-99c56d23e3b2
connection.\"Mobile\"}}"trigger('nextStep');
}
}
function onClickedBack () {
connection.trigger('prevStep');
}
function onGotoStep (step) {
showStep(step);
connection.trigger('ready');
}
function showStep (step, stepIndex) {
if (stepIndex && !step) {
step = steps[stepIndex - 1];
}
currentStep = step;
$('.step').hide();
switch (currentStep.key) {
case 'eventdefinitionkey':
$('#step1').show();
$('#step1 input').focus();
break;
}
}
function save() { //SAVE FUNCTION
console.log('save');
connection.trigger('requestSchema'); //NOT SHOWN IN CONSOLE
let campaignNameKey = $('#select-campaign-name').val();
let csvName = $('#select-csv-name').val();
console.log("DE NAME " + deName);
payload['arguments'] = payload['arguments'] || {};
payload['arguments'].execute = payload['arguments'].execute || {};
payload['arguments'].execute.inArguments = [{
'campaignNameKey': campaignNameKey,
'csvName': csvName,
"Prenom": "{{Contact.Attribute."+ deName +".[\"Prénom\"]}}",
"Nom": "{{Contact.Attribute." + deName +".Nom}}",
"Mobile": "{{Contact.Attribute." + deName +".Mobile}}",
"Campagne": "{{Contact.Attribute." + deName +".Campagne}}",
"stopSMS": "{{Contact.Attribute." + deName +".stopSMS}}"
}];
payload['metaData'] = payload['metaData'] || {};
payload['metaData'].isConfigured = true;
//console.log(JSON.stringify(payload));
connection.trigger('updateActivity', payload);
}
connection.on('requestedSchema', function (data) {
// save schema
console.log('*** Schema ***', JSON.stringify(data['schema']));
let schema = JSON.stringify(data['schema']);
});
connection.on('initActivity', initialize);
connection.on('clickedNext', onClickedNext);
connection.on('clickedBack', onClickedBack);
connection.on('gotoStep', onGotoStep);
});
EDIT :
{
"trigger": {
"id": {
"a": "521ea773-aa99-4755-a596-1b47621bf78d",
"b": null
},
"outcomes": {
"a": []
},
"metaData": {
"sourceInteractionId": {
"a": "00000000-0000-0000-0000-000000000000"
},
"scheduleState": {
"b": "No Schedule"
}
},
"documentArguments": {
"startActivityKey": {
"a": "{{Context.StartActivityKey}}"
},
"dequeueReason": {
"a": "{{Context.DequeueReason}}"
},
"lastExecutedActivityKey": {
"a": "{{Context.LastExecutedActivityKey}}"
},
"filterResult": {
"a": "true"
},
"serializedObjectType": {
"b": 3
},
"eventDefinitionId": {
"b": "eb788811-efee-41a2-8539-dd7cd3581808"
},
"eventDefinitionKey": {
"b": "DEAudience-8a4ce4c8-028d-24ec-13bc-99c56d23e3b2"
},
"dataExtensionId": {
"b": "78f14e04-7cb5-e711-80cf-1402ec819bf8"
},
"automationId": {
"b": "48247447-ca70-443e-b390-ac70cc01a326"
}
},
"schemaVersionId": {
"a": 0
},
"configurationArguments": {
"a": {
"filterDefinitionId": "00000000-0000-0000-0000-000000000000"
}
},
"eventDefinition": {
"deUsageDataReturned": {
"b": null
}
},
"mode": {
"b": "Production"
},
"isVisibleInPicker": {
"b": false
},
"interactionCount": {
"b": 2
},
"publishedInteractionCount": {
"b": 0
},
"dataExtensionId": {
"b": "78f14e04-7cb5-e711-80cf-1402ec819bf8"
},
"schema": {
"b": null
},
"createdDate": {
"b": "2018-06-11T05:43:36.180Z"
},
"createdBy": {
"b": 100125031
},
"modifiedBy": {
"b": 100125031
},
"dataExtensionName": {
"b": "Contacts"
},
"sourceApplicationExtensionId": {
"b": "a62ff9df-dc1c-4e9a-87cd-c05841d79f38"
},
"filterDefinitionTemplate": {
"b": ""
},
"category": {
"b": "Audience"
},
"automationId": {
"b": "48247447-ca70-443e-b390-ac70cc01a326"
},
"scheduleFlowMode": {
"b": "runOnce"
},
"runOnceScheduleMode": {
"b": "onPublish"
},
"unconfigured": {
"b": false
},
"_originalDeAudienceType": {
"b": "EmailAudience"
},
"config": {
"b": {
"internal": true,
"scheduleEnabled": true,
"scheduleTile": true,
"supportsAutomationSchedule": true,
"configurableHighWatermark": true,
"userInterfaces": {
"summary": [
{
"fieldName": "startDateTime",
"valuePath": "schedule.startDateTime",
"label": "Start",
"timezoneOffsetPath": "timezoneOffset",
"type": "date",
"momentFormat": "LLL"
},
{
"fieldName": "timeZone",
"valuePath": "schedule.timeZone",
"label": "Time Zone"
},
{
"fieldName": "frequency",
"valuePath": "schedule.frequency",
"label": "Repeat",
"valueInLang": true
},
{
"fieldName": "interval",
"valuePath": "schedule.interval",
"label": "Repeat Every"
},
{
"fieldName": "customDayOfTheWeek",
"valuePath": "schedule",
"label": "Day(s) of the Week"
},
{
"fieldName": "scheduledDay",
"valuePath": "schedule.scheduledDay",
"label": "Scheduled Day"
},
{
"fieldName": "scheduledDayOfWeek",
"valuePath": "schedule.scheduledDayOfWeek",
"label": "Scheduled Day of the Week",
"valueInLang": true
},
{
"fieldName": "scheduledMonth",
"valuePath": "schedule.scheduledMonth",
"label": "Scheduled Month",
"valueInLang": true
},
{
"fieldName": "scheduledWeek",
"valuePath": "schedule.scheduledWeek",
"label": "Scheduled Week",
"valueInLang": true
},
{
"fieldName": "endDateTime",
"valuePath": "schedule.endDateTime",
"label": "End",
"type": "date",
"momentFormat": "LL"
},
{
"fieldName": "occurrences",
"valuePath": "schedule.occurrences",
"label": "End"
},
{
"fieldName": "useHighWatermark",
"valuePath": "useHighWatermark",
"label": "Evaluate new records only"
},
{
"fieldName": "automationName",
"valuePath": "automation.name",
"label": "Automation Name"
},
{
"fieldName": "activityName",
"valuePath": "activityName",
"label": "Activity Name"
},
{
"fieldName": "deRecordCount",
"valuePath": "deRecordCount",
"label": "Record Count"
},
{
"fieldName": "fileTriggerActive",
"valuePath": "automation.fileTrigger.triggerActive",
"label": "File Trigger Active"
},
{
"fieldName": "fileTriggerFolder",
"valuePath": "automation.fileTrigger.folderLocationText",
"label": "File Trigger Directory"
},
{
"fieldName": "automationStatus",
"valuePath": "automation.status",
"label": "Automation Status"
}
]
},
"lang": {
"en-US": {
"never": "Never",
"hourly": "Hourly",
"daily": "Daily",
"weekly": "Weekly",
"monthly": "Monthly",
"yearly": "Yearly",
"sunday": "Sunday",
"monday": "Monday",
"tuesday": "Tuesday",
"wednesday": "Wednesday",
"thursday": "Thursday",
"friday": "Friday",
"saturday": "Saturday",
"First": "First",
"Second": "Second",
"Third": "Third",
"Fourth": "Fourth",
"Last": "Last",
"January": "January",
"February": "February",
"March": "March",
"April": "April",
"May": "May",
"June": "June",
"July": "July",
"August": "August",
"September": "September",
"October": "October",
"November": "November",
"December": "December",
"true": "Scheduled",
"00:00": "00:00",
"01:00": "01:00",
"02:00": "02:00",
"03:00": "03:00",
"04:00": "04:00",
"05:00": "05:00",
"06:00": "06:00",
"07:00": "07:00",
"08:00": "08:00",
"09:00": "09:00",
"10:00": "10:00",
"11:00": "11:00",
"12:00": "12:00",
"13:00": "13:00",
"14:00": "14:00",
"15:00": "15:00",
"16:00": "16:00",
"17:00": "17:00",
"18:00": "18:00",
"19:00": "19:00",
"20:00": "20:00",
"21:00": "21:00",
"22:00": "22:00",
"23:00": "23:00"
}
},
"entrySourceGroupConfigUrl": "jb:///data/entry/audience/"
}
},
"automation": {
"b": {
"id": "48247447-ca70-443e-b390-ac70cc01a326",
"name": "Test Activity Custom - 2018-06-11T074336.133",
"description": "Event Definition Automation",
"key": "10ed873f-26ab-47ac-a604-46e27c1fdfea",
"typeId": 1,
"type": "scheduled",
"statusId": 2,
"status": "Ready",
"categoryId": 11229,
"lastRunTime": "2018-06-18T08:04:27.667",
"lastRunInstanceId": "a366f85c-6ab0-428c-8481-e0c7b6e7eaa9",
"schedule": {
"scheduleStatus": "none"
},
"steps": [
{
"id": "5ea1a729-74dc-4652-9941-0847291f5279",
"name": "",
"description": "",
"step": 1,
"activities": [
{
"id": "a6a1cdd8-60f0-41f5-9204-3994e29731bf",
"name": "Contacts",
"activityObjectId": "eb788811-efee-41a2-8539-dd7cd3581808",
"objectTypeId": 952,
"displayOrder": 1
}
]
}
]
}
},
"deRecordCount": {
"b": 4
},
"deUsageDataReturned": {
"b": null
}
},
"mobileNumber": {
"0": {
"a": "{{Event.DEAudience-8a4ce4c8-028d-24ec-13bc-99c56d23e3b2.\"Mobile\"}}"
}
}
}
EDIT : my customActivity.js
define(function (require) {
var Postmonger = require('postmonger');
var connection = new Postmonger.Session();
var payload = {};
var steps = [
{'key': 'eventdefinitionkey', 'label': 'Event Definition Key'}
];
//HERE it works
//connection.trigger('requestSchema');
var currentStep = steps[0].key;
var deName;
$(window).ready(function () {
connection.trigger('ready');
});
function initialize(data) {
if (data) {
payload = data;
}
}
function onClickedNext() { //SAVE USED HERE
if (currentStep.key === 'eventdefinitionkey') {
save();
} else {
connection.trigger('nextStep');
}
}
function onClickedBack () {
connection.trigger('prevStep');
}
function onGotoStep (step) {
showStep(step);
connection.trigger('ready');
}
function showStep (step, stepIndex) {
if (stepIndex && !step) {
step = steps[stepIndex - 1];
}
currentStep = step;
$('.step').hide();
switch (currentStep.key) {
case 'eventdefinitionkey':
$('#step1').show();
$('#step1 input').focus();
break;
}
}
function save() { //SAVE FUNCTION
console.log('save');
connection.trigger('requestSchema'); //NOT SHOWN IN CONSOLE
let campaignNameKey = $('#select-campaign-name').val();
let csvName = $('#select-csv-name').val();
console.log("DE NAME " + deName);
payload['arguments'] = payload['arguments'] || {};
payload['arguments'].execute = payload['arguments'].execute || {};
payload['arguments'].execute.inArguments = [{
'campaignNameKey': campaignNameKey,
'csvName': csvName,
"Prenom": "{{Contact.Attribute."+ deName +".[\"Prénom\"]}}",
"Nom": "{{Contact.Attribute." + deName +".Nom}}",
"Mobile": "{{Contact.Attribute." + deName +".Mobile}}",
"Campagne": "{{Contact.Attribute." + deName +".Campagne}}",
"stopSMS": "{{Contact.Attribute." + deName +".stopSMS}}"
}];
payload['metaData'] = payload['metaData'] || {};
payload['metaData'].isConfigured = true;
//console.log(JSON.stringify(payload));
connection.trigger('updateActivity', payload);
}
connection.on('requestedSchema', function (data) {
// save schema
console.log('*** Schema ***', JSON.stringify(data['schema']));
let schema = JSON.stringify(data['schema']);
});
connection.on('initActivity', initialize);
connection.on('clickedNext', onClickedNext);
connection.on('clickedBack', onClickedBack);
connection.on('gotoStep', onGotoStep);
});
{
"trigger": {
"id": {
"a": "521ea773-aa99-4755-a596-1b47621bf78d",
"b": null
},
"outcomes": {
"a": []
},
"metaData": {
"sourceInteractionId": {
"a": "00000000-0000-0000-0000-000000000000"
},
"scheduleState": {
"b": "No Schedule"
}
},
"documentArguments": {
"startActivityKey": {
"a": "{{Context.StartActivityKey}}"
},
"dequeueReason": {
"a": "{{Context.DequeueReason}}"
},
"lastExecutedActivityKey": {
"a": "{{Context.LastExecutedActivityKey}}"
},
"filterResult": {
"a": "true"
},
"serializedObjectType": {
"b": 3
},
"eventDefinitionId": {
"b": "eb788811-efee-41a2-8539-dd7cd3581808"
},
"eventDefinitionKey": {
"b": "DEAudience-8a4ce4c8-028d-24ec-13bc-99c56d23e3b2"
},
"dataExtensionId": {
"b": "78f14e04-7cb5-e711-80cf-1402ec819bf8"
},
"automationId": {
"b": "48247447-ca70-443e-b390-ac70cc01a326"
}
},
"schemaVersionId": {
"a": 0
},
"configurationArguments": {
"a": {
"filterDefinitionId": "00000000-0000-0000-0000-000000000000"
}
},
"eventDefinition": {
"deUsageDataReturned": {
"b": null
}
},
"mode": {
"b": "Production"
},
"isVisibleInPicker": {
"b": false
},
"interactionCount": {
"b": 2
},
"publishedInteractionCount": {
"b": 0
},
"dataExtensionId": {
"b": "78f14e04-7cb5-e711-80cf-1402ec819bf8"
},
"schema": {
"b": null
},
"createdDate": {
"b": "2018-06-11T05:43:36.180Z"
},
"createdBy": {
"b": 100125031
},
"modifiedBy": {
"b": 100125031
},
"dataExtensionName": {
"b": "Contacts"
},
"sourceApplicationExtensionId": {
"b": "a62ff9df-dc1c-4e9a-87cd-c05841d79f38"
},
"filterDefinitionTemplate": {
"b": ""
},
"category": {
"b": "Audience"
},
"automationId": {
"b": "48247447-ca70-443e-b390-ac70cc01a326"
},
"scheduleFlowMode": {
"b": "runOnce"
},
"runOnceScheduleMode": {
"b": "onPublish"
},
"unconfigured": {
"b": false
},
"_originalDeAudienceType": {
"b": "EmailAudience"
},
"config": {
"b": {
"internal": true,
"scheduleEnabled": true,
"scheduleTile": true,
"supportsAutomationSchedule": true,
"configurableHighWatermark": true,
"userInterfaces": {
"summary": [
{
"fieldName": "startDateTime",
"valuePath": "schedule.startDateTime",
"label": "Start",
"timezoneOffsetPath": "timezoneOffset",
"type": "date",
"momentFormat": "LLL"
},
{
"fieldName": "timeZone",
"valuePath": "schedule.timeZone",
"label": "Time Zone"
},
{
"fieldName": "frequency",
"valuePath": "schedule.frequency",
"label": "Repeat",
"valueInLang": true
},
{
"fieldName": "interval",
"valuePath": "schedule.interval",
"label": "Repeat Every"
},
{
"fieldName": "customDayOfTheWeek",
"valuePath": "schedule",
"label": "Day(s) of the Week"
},
{
"fieldName": "scheduledDay",
"valuePath": "schedule.scheduledDay",
"label": "Scheduled Day"
},
{
"fieldName": "scheduledDayOfWeek",
"valuePath": "schedule.scheduledDayOfWeek",
"label": "Scheduled Day of the Week",
"valueInLang": true
},
{
"fieldName": "scheduledMonth",
"valuePath": "schedule.scheduledMonth",
"label": "Scheduled Month",
"valueInLang": true
},
{
"fieldName": "scheduledWeek",
"valuePath": "schedule.scheduledWeek",
"label": "Scheduled Week",
"valueInLang": true
},
{
"fieldName": "endDateTime",
"valuePath": "schedule.endDateTime",
"label": "End",
"type": "date",
"momentFormat": "LL"
},
{
"fieldName": "occurrences",
"valuePath": "schedule.occurrences",
"label": "End"
},
{
"fieldName": "useHighWatermark",
"valuePath": "useHighWatermark",
"label": "Evaluate new records only"
},
{
"fieldName": "automationName",
"valuePath": "automation.name",
"label": "Automation Name"
},
{
"fieldName": "activityName",
"valuePath": "activityName",
"label": "Activity Name"
},
{
"fieldName": "deRecordCount",
"valuePath": "deRecordCount",
"label": "Record Count"
},
{
"fieldName": "fileTriggerActive",
"valuePath": "automation.fileTrigger.triggerActive",
"label": "File Trigger Active"
},
{
"fieldName": "fileTriggerFolder",
"valuePath": "automation.fileTrigger.folderLocationText",
"label": "File Trigger Directory"
},
{
"fieldName": "automationStatus",
"valuePath": "automation.status",
"label": "Automation Status"
}
]
},
"lang": {
"en-US": {
"never": "Never",
"hourly": "Hourly",
"daily": "Daily",
"weekly": "Weekly",
"monthly": "Monthly",
"yearly": "Yearly",
"sunday": "Sunday",
"monday": "Monday",
"tuesday": "Tuesday",
"wednesday": "Wednesday",
"thursday": "Thursday",
"friday": "Friday",
"saturday": "Saturday",
"First": "First",
"Second": "Second",
"Third": "Third",
"Fourth": "Fourth",
"Last": "Last",
"January": "January",
"February": "February",
"March": "March",
"April": "April",
"May": "May",
"June": "June",
"July": "July",
"August": "August",
"September": "September",
"October": "October",
"November": "November",
"December": "December",
"true": "Scheduled",
"00:00": "00:00",
"01:00": "01:00",
"02:00": "02:00",
"03:00": "03:00",
"04:00": "04:00",
"05:00": "05:00",
"06:00": "06:00",
"07:00": "07:00",
"08:00": "08:00",
"09:00": "09:00",
"10:00": "10:00",
"11:00": "11:00",
"12:00": "12:00",
"13:00": "13:00",
"14:00": "14:00",
"15:00": "15:00",
"16:00": "16:00",
"17:00": "17:00",
"18:00": "18:00",
"19:00": "19:00",
"20:00": "20:00",
"21:00": "21:00",
"22:00": "22:00",
"23:00": "23:00"
}
},
"entrySourceGroupConfigUrl": "jb:///data/entry/audience/"
}
},
"automation": {
"b": {
"id": "48247447-ca70-443e-b390-ac70cc01a326",
"name": "Test Activity Custom - 2018-06-11T074336.133",
"description": "Event Definition Automation",
"key": "10ed873f-26ab-47ac-a604-46e27c1fdfea",
"typeId": 1,
"type": "scheduled",
"statusId": 2,
"status": "Ready",
"categoryId": 11229,
"lastRunTime": "2018-06-18T08:04:27.667",
"lastRunInstanceId": "a366f85c-6ab0-428c-8481-e0c7b6e7eaa9",
"schedule": {
"scheduleStatus": "none"
},
"steps": [
{
"id": "5ea1a729-74dc-4652-9941-0847291f5279",
"name": "",
"description": "",
"step": 1,
"activities": [
{
"id": "a6a1cdd8-60f0-41f5-9204-3994e29731bf",
"name": "Contacts",
"activityObjectId": "eb788811-efee-41a2-8539-dd7cd3581808",
"objectTypeId": 952,
"displayOrder": 1
}
]
}
]
}
},
"deRecordCount": {
"b": 4
},
"deUsageDataReturned": {
"b": null
}
},
"mobileNumber": {
"0": {
"a": "{{Event.DEAudience-8a4ce4c8-028d-24ec-13bc-99c56d23e3b2.\"Mobile\"}}"
}
}
}
{
"trigger": {
"dataExtensionName": {
"b": "Contacts"
},
"sourceApplicationExtensionId": {
"b": "a62ff9df-dc1c-4e9a-87cd-c05841d79f38"
},
"filterDefinitionTemplate": {
"b": ""
},
"category": {
"b": "Audience"
},
"automationId": {
"b": "48247447-ca70-443e-b390-ac70cc01a326"
},
"scheduleFlowMode": {
"b": "runOnce"
},
"runOnceScheduleMode": {
"b": "onPublish"
},
"unconfigured": {
"b": false
},
"_originalDeAudienceType": {
"b": "EmailAudience"
},
"config": {
"b": {
"internal": true,
"scheduleEnabled": true,
"scheduleTile": true,
"supportsAutomationSchedule": true,
"configurableHighWatermark": true,
"userInterfaces": {
"summary": [
{
"fieldName": "startDateTime",
"valuePath": "schedule.startDateTime",
"label": "Start",
"timezoneOffsetPath": "timezoneOffset",
"type": "date",
"momentFormat": "LLL"
},
{
"fieldName": "timeZone",
"valuePath": "schedule.timeZone",
"label": "Time Zone"
},
{
"fieldName": "frequency",
"valuePath": "schedule.frequency",
"label": "Repeat",
"valueInLang": true
},
{
"fieldName": "interval",
"valuePath": "schedule.interval",
"label": "Repeat Every"
},
{
"fieldName": "customDayOfTheWeek",
"valuePath": "schedule",
"label": "Day(s) of the Week"
},
{
"fieldName": "scheduledDay",
"valuePath": "schedule.scheduledDay",
"label": "Scheduled Day"
},
{
"fieldName": "scheduledDayOfWeek",
"valuePath": "schedule.scheduledDayOfWeek",
"label": "Scheduled Day of the Week",
"valueInLang": true
},
{
"fieldName": "scheduledMonth",
"valuePath": "schedule.scheduledMonth",
"label": "Scheduled Month",
"valueInLang": true
},
{
"fieldName": "scheduledWeek",
"valuePath": "schedule.scheduledWeek",
"label": "Scheduled Week",
"valueInLang": true
},
{
"fieldName": "endDateTime",
"valuePath": "schedule.endDateTime",
"label": "End",
"type": "date",
"momentFormat": "LL"
},
{
"fieldName": "occurrences",
"valuePath": "schedule.occurrences",
"label": "End"
},
{
"fieldName": "useHighWatermark",
"valuePath": "useHighWatermark",
"label": "Evaluate new records only"
},
{
"fieldName": "automationName",
"valuePath": "automation.name",
"label": "Automation Name"
},
{
"fieldName": "activityName",
"valuePath": "activityName",
"label": "Activity Name"
},
{
"fieldName": "deRecordCount",
"valuePath": "deRecordCount",
"label": "Record Count"
},
{
"fieldName": "fileTriggerActive",
"valuePath": "automation.fileTrigger.triggerActive",
"label": "File Trigger Active"
},
{
"fieldName": "fileTriggerFolder",
"valuePath": "automation.fileTrigger.folderLocationText",
"label": "File Trigger Directory"
},
{
"fieldName": "automationStatus",
"valuePath": "automation.status",
"label": "Automation Status"
}
]
},
"lang": {
"en-US": {
"never": "Never",
"hourly": "Hourly",
"daily": "Daily",
"weekly": "Weekly",
"monthly": "Monthly",
"yearly": "Yearly",
"sunday": "Sunday",
"monday": "Monday",
"tuesday": "Tuesday",
"wednesday": "Wednesday",
"thursday": "Thursday",
"friday": "Friday",
"saturday": "Saturday",
"First": "First",
"Second": "Second",
"Third": "Third",
"Fourth": "Fourth",
"Last": "Last",
"January": "January",
"February": "February",
"March": "March",
"April": "April",
"May": "May",
"June": "June",
"July": "July",
"August": "August",
"September": "September",
"October": "October",
"November": "November",
"December": "December",
"true": "Scheduled",
"00:00": "00:00",
"01:00": "01:00",
"02:00": "02:00",
"03:00": "03:00",
"04:00": "04:00",
"05:00": "05:00",
"06:00": "06:00",
"07:00": "07:00",
"08:00": "08:00",
"09:00": "09:00",
"10:00": "10:00",
"11:00": "11:00",
"12:00": "12:00",
"13:00": "13:00",
"14:00": "14:00",
"15:00": "15:00",
"16:00": "16:00",
"17:00": "17:00",
"18:00": "18:00",
"19:00": "19:00",
"20:00": "20:00",
"21:00": "21:00",
"22:00": "22:00",
"23:00": "23:00"
}
},
"entrySourceGroupConfigUrl": "jb:///data/entry/audience/"
}
},
"automation": {
"b": {
"id": "48247447-ca70-443e-b390-ac70cc01a326",
"name": "Test Activity Custom - 2018-06-11T074336.133",
"description": "Event Definition Automation",
"key": "10ed873f-26ab-47ac-a604-46e27c1fdfea",
"typeId": 1,
"type": "scheduled",
"statusId": 2,
"status": "Ready",
"categoryId": 11229,
"lastRunTime": "2018-06-18T08:04:27.667",
"lastRunInstanceId": "a366f85c-6ab0-428c-8481-e0c7b6e7eaa9",
"schedule": {
"scheduleStatus": "none"
},
"steps": [
{
"id": "5ea1a729-74dc-4652-9941-0847291f5279",
"name": "",
"description": "",
"step": 1,
"activities": [
{
"id": "a6a1cdd8-60f0-41f5-9204-3994e29731bf",
"name": "Contacts",
"activityObjectId": "eb788811-efee-41a2-8539-dd7cd3581808",
"objectTypeId": 952,
"displayOrder": 1
}
]
}
]
}
},
"deRecordCount": {
"b": 4
},
"deUsageDataReturned": {
"b": null
}
},
"mobileNumber": {
"0": {
"a": "{{Event.DEAudience-8a4ce4c8-028d-24ec-13bc-99c56d23e3b2.\"Mobile\"}}"
}
}
}
{
"trigger": {
"id": {
"a": "521ea773-aa99-4755-a596-1b47621bf78d",
"b": null
},
"outcomes": {
"a": []
},
"metaData": {
"sourceInteractionId": {
"a": "00000000-0000-0000-0000-000000000000"
},
"scheduleState": {
"b": "No Schedule"
}
},
"documentArguments": {
"startActivityKey": {
"a": "{{Context.StartActivityKey}}"
},
"dequeueReason": {
"a": "{{Context.DequeueReason}}"
},
"lastExecutedActivityKey": {
"a": "{{Context.LastExecutedActivityKey}}"
},
"filterResult": {
"a": "true"
},
"serializedObjectType": {
"b": 3
},
"eventDefinitionId": {
"b": "eb788811-efee-41a2-8539-dd7cd3581808"
},
"eventDefinitionKey": {
"b": "DEAudience-8a4ce4c8-028d-24ec-13bc-99c56d23e3b2"
},
"dataExtensionId": {
"b": "78f14e04-7cb5-e711-80cf-1402ec819bf8"
},
"automationId": {
"b": "48247447-ca70-443e-b390-ac70cc01a326"
}
},
"schemaVersionId": {
"a": 0
},
"configurationArguments": {
"a": {
"filterDefinitionId": "00000000-0000-0000-0000-000000000000"
}
},
"eventDefinition": {
"deUsageDataReturned": {
"b": null
}
},
"mode": {
"b": "Production"
},
"isVisibleInPicker": {
"b": false
},
"interactionCount": {
"b": 2
},
"publishedInteractionCount": {
"b": 0
},
"dataExtensionId": {
"b": "78f14e04-7cb5-e711-80cf-1402ec819bf8"
},
"schema": {
"b": null
},
"createdDate": {
"b": "2018-06-11T05:43:36.180Z"
},
"createdBy": {
"b": 100125031
},
"modifiedBy": {
"b": 100125031
},
"dataExtensionName": {
"b": "Contacts"
},
"sourceApplicationExtensionId": {
"b": "a62ff9df-dc1c-4e9a-87cd-c05841d79f38"
},
"filterDefinitionTemplate": {
"b": ""
},
"category": {
"b": "Audience"
},
"automationId": {
"b": "48247447-ca70-443e-b390-ac70cc01a326"
},
"scheduleFlowMode": {
"b": "runOnce"
},
"runOnceScheduleMode": {
"b": "onPublish"
},
"unconfigured": {
"b": false
},
"_originalDeAudienceType": {
"b": "EmailAudience"
},
"config": {
"b": {
"internal": true,
"scheduleEnabled": true,
"scheduleTile": true,
"supportsAutomationSchedule": true,
"configurableHighWatermark": true,
"userInterfaces": {
"summary": [
{
"fieldName": "startDateTime",
"valuePath": "schedule.startDateTime",
"label": "Start",
"timezoneOffsetPath": "timezoneOffset",
"type": "date",
"momentFormat": "LLL"
},
{
"fieldName": "timeZone",
"valuePath": "schedule.timeZone",
"label": "Time Zone"
},
{
"fieldName": "frequency",
"valuePath": "schedule.frequency",
"label": "Repeat",
"valueInLang": true
},
{
"fieldName": "interval",
"valuePath": "schedule.interval",
"label": "Repeat Every"
},
{
"fieldName": "customDayOfTheWeek",
"valuePath": "schedule",
"label": "Day(s) of the Week"
},
{
"fieldName": "scheduledDay",
"valuePath": "schedule.scheduledDay",
"label": "Scheduled Day"
},
{
"fieldName": "scheduledDayOfWeek",
"valuePath": "schedule.scheduledDayOfWeek",
"label": "Scheduled Day of the Week",
"valueInLang": true
},
{
"fieldName": "scheduledMonth",
"valuePath": "schedule.scheduledMonth",
"label": "Scheduled Month",
"valueInLang": true
},
{
"fieldName": "scheduledWeek",
"valuePath": "schedule.scheduledWeek",
"label": "Scheduled Week",
"valueInLang": true
},
{
"fieldName": "endDateTime",
"valuePath": "schedule.endDateTime",
"label": "End",
"type": "date",
"momentFormat": "LL"
},
{
"fieldName": "occurrences",
"valuePath": "schedule.occurrences",
"label": "End"
},
{
"fieldName": "useHighWatermark",
"valuePath": "useHighWatermark",
"label": "Evaluate new records only"
},
{
"fieldName": "automationName",
"valuePath": "automation.name",
"label": "Automation Name"
},
{
"fieldName": "activityName",
"valuePath": "activityName",
"label": "Activity Name"
},
{
"fieldName": "deRecordCount",
"valuePath": "deRecordCount",
"label": "Record Count"
},
{
"fieldName": "fileTriggerActive",
"valuePath": "automation.fileTrigger.triggerActive",
"label": "File Trigger Active"
},
{
"fieldName": "fileTriggerFolder",
"valuePath": "automation.fileTrigger.folderLocationText",
"label": "File Trigger Directory"
},
{
"fieldName": "automationStatus",
"valuePath": "automation.status",
"label": "Automation Status"
}
]
},
"lang": {
"en-US": {
"never": "Never",
"hourly": "Hourly",
"daily": "Daily",
"weekly": "Weekly",
"monthly": "Monthly",
"yearly": "Yearly",
"sunday": "Sunday",
"monday": "Monday",
"tuesday": "Tuesday",
"wednesday": "Wednesday",
"thursday": "Thursday",
"friday": "Friday",
"saturday": "Saturday",
"First": "First",
"Second": "Second",
"Third": "Third",
"Fourth": "Fourth",
"Last": "Last",
"January": "January",
"February": "February",
"March": "March",
"April": "April",
"May": "May",
"June": "June",
"July": "July",
"August": "August",
"September": "September",
"October": "October",
"November": "November",
"December": "December",
"true": "Scheduled",
"00:00": "00:00",
"01:00": "01:00",
"02:00": "02:00",
"03:00": "03:00",
"04:00": "04:00",
"05:00": "05:00",
"06:00": "06:00",
"07:00": "07:00",
"08:00": "08:00",
"09:00": "09:00",
"10:00": "10:00",
"11:00": "11:00",
"12:00": "12:00",
"13:00": "13:00",
"14:00": "14:00",
"15:00": "15:00",
"16:00": "16:00",
"17:00": "17:00",
"18:00": "18:00",
"19:00": "19:00",
"20:00": "20:00",
"21:00": "21:00",
"22:00": "22:00",
"23:00": "23:00"
}
},
"entrySourceGroupConfigUrl": "jb:///data/entry/audience/"
}
},
"automation": {
"b": {
"id": "48247447-ca70-443e-b390-ac70cc01a326",
"name": "Test Activity Custom - 2018-06-11T074336.133",
"description": "Event Definition Automation",
"key": "10ed873f-26ab-47ac-a604-46e27c1fdfea",
"typeId": 1,
"type": "scheduled",
"statusId": 2,
"status": "Ready",
"categoryId": 11229,
"lastRunTime": "2018-06-18T08:04:27.667",
"lastRunInstanceId": "a366f85c-6ab0-428c-8481-e0c7b6e7eaa9",
"schedule": {
"scheduleStatus": "none"
},
"steps": [
{
"id": "5ea1a729-74dc-4652-9941-0847291f5279",
"name": "",
"description": "",
"step": 1,
"activities": [
{
"id": "a6a1cdd8-60f0-41f5-9204-3994e29731bf",
"name": "Contacts",
"activityObjectId": "eb788811-efee-41a2-8539-dd7cd3581808",
"objectTypeId": 952,
"displayOrder": 1
}
]
}
]
}
},
"deRecordCount": {
"b": 4
},
"deUsageDataReturned": {
"b": null
}
},
"mobileNumber": {
"0": {
"a": "{{Event.DEAudience-8a4ce4c8-028d-24ec-13bc-99c56d23e3b2.\"Mobile\"}}"
}
}
}
Loading
lang-js