This blog will take you through the Outbound Triggers – triggers that are sent from Campaign to other applications.

Outbound Trigger –

An outbound trigger is the execution of a command, batch file, or script (that is stored on the Campaign Application Server) that takes place after a flowchart or process is run. You can define triggers to perform virtually any action, such as opening an application, sending an email, or running a program.

Campaign can execute an outbound trigger when a Schedule, Call List, or Mail List process executes. For example, when a Call List process completes, an outbound trigger can send an automatic email informing a manager that a list of contacts is ready.

Triggers execute on completion of test runs as well as of production runs. Campaign can also automatically execute an outbound trigger when a flowchart runs. You can configure different triggers for when the flowchart completes successfully, or fails.

Examples include:
a)     A trigger that transfers a file to the mainframe.  A script is written to FTP the file.  A trigger  is created that calls this script.  The trigger is called from a Mail List process after the vendor file is successfully created.
b)    A trigger that sends an email to user after a flowchart completes successfully.  A script is written that has the commands to communicate with a mail server to send an email to the appropriate user.  A trigger is created that calls this script.  The trigger is called from the Admin menu, on the Advanced Settings tab.


​1.     Synchronous outbound triggers

When Campaign runs an outbound trigger synchronously, the process that called it waits for the executed command to complete and return with a success or failure status. In other words, the flowchart does not continue running until the results of the trigger are returned. If the trigger fails, as indicated by a non-zero return value, the process box does not continue processing and indicates an error (with a red X) and an appropriate error message.
 
Synchronous execution is useful when the flowchart is waiting for an external process to complete its work before continuing. For example, a synchronous outbound trigger could run third-party predictive model scores in real-time, and the flowchart would wait until it completed before selecting from the updated model scores.
 
To make an outbound trigger synchronous, you terminate the command in the trigger definition with a question mark (?). For example:
 
triggers\synchronous_email_update.cmd?
 
2.     Asynchronous outbound triggers
When an asynchronous outbound trigger executes, the flowchart processing continues immediately; the process that called the trigger does not wait for it to succeed or fail.  To make an outbound trigger asynchronous, you do not have to add a termination character.
 
However, to ensure that it is explicitly understood that the trigger is asynchronous, you can terminate the command with an ampersand (&). For example:
triggers\asynchronous_email_update.cmd&
 
3.     Creating an Outbound Trigger
1)     From within a flowchart go to Tools > Stored Triggers
 

Picture

1)     Click New Item and Name the trigger
2)     Add a description of the file to the Note section
3)     Click Browse to select the batch file or script – this will capture the name and location of the file and Save
Note List of token can also be passed to the script.
5)     Clicking on “Run Trigger” button can test the trigger.
6)     The trigger may be edited by clicking on Edit\Move.
Available Tokens to Pass to a Script
The trigger can pass tokens into the script.  The following tokens are supported for triggers:
#element-24edb368-8911-44b7-83a8-81e52eef33e0 .simple-table-wrapper {
padding: 20px 0;
}
#element-24edb368-8911-44b7-83a8-81e52eef33e0 .simple-table {
width: 100%;
border: 1px solid #515151;
border-spacing: 0;
}
#element-24edb368-8911-44b7-83a8-81e52eef33e0 .simple-table td.cell {
border-right: 1px solid #515151;
border-bottom: 1px solid #515151;
word-break: break-word;
background-color: #FFFFFF;
width: 33.333333333333%;
}
#element-24edb368-8911-44b7-83a8-81e52eef33e0 .simple-table td.cell .paragraph {
width: 90%;
margin: 0 5%;
padding-bottom: 10px;
padding-top: 10px;
text-align: left;
}
#element-24edb368-8911-44b7-83a8-81e52eef33e0 .simple-table.style-top tr:first-child td,
#element-24edb368-8911-44b7-83a8-81e52eef33e0 .simple-table.style-side td:first-of-type {
background-color: #3a96b8;
}
#element-24edb368-8911-44b7-83a8-81e52eef33e0 .simple-table.style-top tr:first-child td .paragraph,
#element-24edb368-8911-44b7-83a8-81e52eef33e0 .simple-table.style-side td:first-of-type .paragraph {
font-weight: 700;
}
#element-24edb368-8911-44b7-83a8-81e52eef33e0 .simple-table tr:last-child td {
border-bottom: none;
}
#element-24edb368-8911-44b7-83a8-81e52eef33e0 .simple-table td:last-of-type {
border-right: none;
}
#element-24edb368-8911-44b7-83a8-81e52eef33e0 .simple-table .empty-content-area-element {
padding-left: 0px !important;
}

Call List and Mail List processes.
Call List and Mail List processes.
<OUTPUTTEMPTABLE>

A token for use in raw SQL in pre- and post-processing
under the Advanced window to create a temp table. For example:
Create <OUTPUTTEMPTABLE> as SELECT
CustIDs from CustomerTable WHERE

Select process
The Security Manager user name of the user who created the flowchart.
<UserVar.
UserVarName>

function setupElement299664710298866845() {
var requireFunc = window.platformElementRequire || window.require;
// Relies on a global require, specific to platform elements
requireFunc([
‘w-global’,
‘underscore’,
‘jquery’,
‘backbone’,
‘util/platform/elements/PlatformElement’,
‘util/platform/elements/PlatformElementSettings’
], function(
_W,
_,
$,
Backbone,
PlatformElement,
PlatformElementSettings
) {
var dependencies = null || [];
var platform_element_id = “702688850553606843-1.4.3”;
if (typeof _W.loadedPlatformDependencies === ‘undefined’) {
_W.loadedPlatformDependencies = [];
}
if (typeof _W.platformElements === ‘undefined’) {
_W.platformElements = [];
}
if (typeof _W.platformElements[platform_element_id] === ‘undefined’) {
_W.platformElements[platform_element_id] = {};
_W.platformElements[platform_element_id].deferredObject = new $.Deferred();
_W.platformElements[platform_element_id].deferredPromise = _W.platformElements[platform_element_id].deferredObject.promise();
}
if(_.intersection(_W.loadedPlatformDependencies, dependencies).length !== dependencies.length){
_.reduce(dependencies, function(promise, nextScript){
_W.loadedPlatformDependencies.push(nextScript);
return promise.then(function(){
return $.getScript(nextScript);
});
}, $().promise()).then(function(){
_W.platformElements[platform_element_id].deferredObject.resolve();
});
}
if (dependencies.length === 0){
_W.platformElements[platform_element_id].deferredObject.resolve();
}
_W.platformElements[platform_element_id].deferredPromise.done(function(){
var _ElementDefinition = /**
* This is required for element rendering to be possible
* @type {PlatformElement}
*/
(function() {
var SimpleTable = PlatformElement.extend({
initialize: function() {
this.setSizes();
},
setSizes: function() {
var sizes = this.settings.get(‘tableSizes’);
// if the # of columns isn’t the size of the array of lengths, ignore it.
if (sizes && sizes != “default” && this.settings.get(‘columns’) == sizes.length) {
var columns = this.$(‘tr’).each(function(index, value) {
var cells = $(value).find(‘td’).each(function(index2, value2) {
$(value2).css(‘width’, sizes[index2] + ‘%’);
});
});
}
}
});
return SimpleTable;
})();;
if (typeof _ElementDefinition == ‘undefined’ || typeof _ElementDefinition == ‘null’) {
var _ElementDefinition = PlatformElement.extend({});
}
var _Element = _ElementDefinition.extend({
initialize: function() {
// we still want to call the initialize function defined by the developer
// however, we don’t want to call it until placeholders have been replaced
this.placeholderInterval = setInterval(function() {
// so use setInterval to check for placeholders.
if (this.$(‘.platform-element-child-placeholder’).length == 0) {
clearInterval(this.placeholderInterval);
this.constructor.__super__.initialize.apply(this);
}
}.bind(this), 100);
}
});
_Element.prototype.settings = new PlatformElementSettings({“columns_each”:[{“columns_index”:0},{“columns_index”:1},{“columns_index”:2}],”rows_each”:[{“rows_index”:0},{“rows_index”:1},{“rows_index”:2},{“rows_index”:3},{“rows_index”:4},{“rows_index”:5},{“rows_index”:6},{“rows_index”:7},{“rows_index”:8},{“rows_index”:9},{“rows_index”:10},{“rows_index”:11}],”columns”:3,”rows”:12,”style”:”top”,”alignment”:”left”,”titleColor”:”#3a96b8″,”backgroundColor”:”#FFFFFF”,”borderColor”:”#515151″,”tableSizes”:”default”});
_Element.prototype.settings.page_element_id = “299664710298866845”;
_Element.prototype.element_id = “24edb368-8911-44b7-83a8-81e52eef33e0”;
_Element.prototype.user_id = “102707030”;
_Element.prototype.site_id = “216674772855878839”;
_Element.prototype.assets_path = “//marketplace.editmysite.com/elements/702688850553606843-1.4.3/assets/”;
new _Element({
el: ‘#element-24edb368-8911-44b7-83a8-81e52eef33e0’
});
});
});
}
if (typeof document.documentElement.appReady == ‘undefined’) {
document.documentElement.appReady = 0;
}
if (document.documentElement.appReady || (window.inEditor && window.inEditor())) {
setupElement299664710298866845();
} else if (document.createEvent && document.addEventListener) {
document.addEventListener(‘appReady’, setupElement299664710298866845, false);
} else {
document.documentElement.attachEvent(‘onpropertychange’, function(event){
if (event.propertyName == ‘appReady’) {
setupElement299664710298866845();
}
});
}

4.     How to call an Outbound Trigger
A trigger can be called from a number of locations within a flowchart.  These include:

1)     Admin Menu -> Advanced Settings
A trigger may be called from the Send Trigger(s) on Flowchart Run Error and Success dropdowns. 
 
2)     Schedule Process
A trigger can be called after the Schedule process has completed its’ run.
3)     Mail List and Call List process

A trigger can be called after the file or table has been created on the Contact List tab.

Marketing Platform, Campaign, Interact, Marketing Operations, Contact Optimization, and Opportunity Detect are trademarks of IBM Corporation, in at least one jurisdiction, and are used under license. 

Picture

  ​Sumitra Chachar
  Product Manager
  HCL Products and Platforms

Further Reading