Adobe Campaign, Marketing Automation

Deploy workflow templates with JavaScript

Spawn workflows programatically

Adobe Campaign is a powerful tool for creating and managing marketing campaigns. One of its most useful features is the ability to create automated workflows. In this post, we will walk you through the process of “spawning” workflows in Adobe Campaign.

What is spawning a workflow? And why and where we can it be useful in our Adobe Campaign instance?

Imagine a technical workflow that involves exporting daily data. Every night, we export the changes in all tracking and delivery logs that occurred on the previous day. If this workflow fails without detection, we may lose data from multiple days. Fixing the issue requires modifying the exporting process to retrieve only the missing data from past days, which can be a time-consuming and labor-intensive task. However, if we create a separate workflow for each daily export, we can quickly restart any failed workflow for a specific day without losing any data or halting the process due to a failure on one day.

Another scenario where separation of workflows can be beneficial is when dealing with a technical workflow that involves frequent signal activity, with multiple calls being made every minute. In such cases, the incoming calls are queued up, leading to significant processing delays. By directing each remote call to run in a separate workflow, we can potentially achieve a major improvement in processing speed.

To address these scenarios, one possible approach is to spawn a workflow using the JSAPI function NLWS.xtkWorkflow.Spawn(). By following the steps outlined below, you can create a more robust process and potentially improve the time it takes to process data.

Step 1: Create a Workflow Template

The first step is to create a workflow template that contains all the activities you want to perform after the signal activity. Instead of using a signal activity, use a start activity and change the name to something like “start00”. Set the execution folder somewhere where all the workflows will be dumped so you have them nicely separated and later we can remove them or resolve any errors.

Step 2: Add Initialization Script

Go into the initialization script and add the following code:

var initVars = "vars.myvar1='" + vars.myvar1 + "'\n;"+
               "vars.myvar2='" + vars.myvar1 + "'\n;";

var workflowVars = 
<workflow label={"Process data " + formatDate(new Date,"- %4Y%2M%2D%02H:%02N:%02S")}
  <start name="start00">
        <start name="start00">

This code will create a new workflow every time the signal activity is triggered, with the initialization script set up as specified.

Step 3: Clean Up Service

After some time, you will end up with thousands of workflows. Ideally, you should create a clean-up service that will remove all workflows from the folder that are finished and last start time is more than 30 minutes. To do this, create another workflow scheduled to run every 30 minutes that calls the “Update Data” activity with the delete option. This will only keep all failed workflows for you to fix and restart, and workflows that are not older than 30 minutes.


In this post, we’ve shown you how to create automated workflows in Adobe Campaign. By following these steps, you can set up a system that will automatically create workflows based on a template, with the technical process logic, and clean up any completed workflows that are no longer needed. With this in place, you can save time and streamline your technical processes.

Let me know in the comments how did you used this method in your Adobe Campaign Instance?

Oh hi there 👋
I have a FREE e-book for you.

Sign up now to get an in-depth analysis of Adobe and Salesforce Marketing Clouds!

We don’t spam! Read our privacy policy for more info.

#JavaScript #programming #workflow
Marcel Szimonisz
Marcel Szimonisz
MarTech consultant As a marketing automation consultant, I specialize in problem-solving, process automation, and driving innovation for clients' marketing platforms.

I hold certifications in Adobe Campaign v6 (3x certified) and Salesforce Marketing Cloud (5x certified), as well as 1x Salesforce Associate certified.

Moreover, I serve as a community advisor for Adobe Campaign, providing expert insights and guidance.

Beyond my professional pursuits, I explore various programming languages, CMSs, and frameworks, enhancing my technical expertise and staying at the forefront of industry advancements.
Take a look at our subscription offering in case you are looking for a Marketing Automation Consultant.

Warning: Undefined variable $html_req in /data/4/5/4510ad42-f743-4235-ae28-11c75c39e09d/ on line 105

Warning: Undefined variable $html5 in /data/4/5/4510ad42-f743-4235-ae28-11c75c39e09d/ on line 117

Warning: Undefined variable $html_req in /data/4/5/4510ad42-f743-4235-ae28-11c75c39e09d/ on line 119

Warning: Undefined variable $html5 in /data/4/5/4510ad42-f743-4235-ae28-11c75c39e09d/ on line 131

Warning: Undefined variable $consent in /data/4/5/4510ad42-f743-4235-ae28-11c75c39e09d/ on line 139

Leave a comment

Your email address will not be published. Required fields are marked *

Similar posts that you may find useful

Salesforce Marketing Cloud Tips
Marketing Automation, Salesforce Marketing Cloud, SFMC Tips & Tricks

Troubleshooting issues with Data Extensions

1 minute read

There are other aspects that I find rather unknown; while there is likely a rational explanation, the platform doesn’t provide straightforward answers. Here are some learnings of mine while working with data extensions: Importing in Contact Builder throws a validation error on the date field. The same file has been successfully imported via Email Studio.

Continue reading
Queries in SSJS and AMPScript
Marketing Automation, Salesforce Marketing Cloud

Query data extensions with SSJS and AMPScript

1 minute read

There’s another topic for which official documentation often lacks sufficient information, but it can be incredibly useful when needed. It’s important to note that in AMPScript, we use the data extension name to reference the table for any query. On the other hand, in SSJS, we utilize the data extension’s external key to reference the […]

Continue reading
Marketing Automation, Salesforce Marketing Cloud

Add reCAPTCHA to landing page form in salesforce marketing cloud

3 minutes read

Last time we implemented recaptcha for this blog that is build on WordPress CMS. You can read the article here. Today I will show you, how to implement same recaptcha from google but on Salesforce Marketing Cloud Pages. To register your cloud page, you will need to register each domain separately, visit  google recaptcha and […]

Continue reading
Salesforce Marketing Cloud Tips
Marketing Automation, Salesforce Marketing Cloud, SFMC Tips & Tricks

Journey validation fails for no reason

less than a minute read

There is an error with starting the journey, specifically related to the email template, but it gives you no explanation whatsoever. I’m sure there can be many problems with the template that prevent the journey from being started. One of the problems I have experienced most recently is that the template has not been approved. […]

Continue reading
Salesforce Marketing Cloud Tips
Marketing Automation, Salesforce Marketing Cloud, SFMC Tips & Tricks

How to refresh data extension records

1 minute read

You might have noticed that records are not refreshed automatically, which makes sense. However, there is no refresh button. Here are some helpful tips I’ve discovered on how to refresh records within the data extension while it’s open. Email studio In email studio it is failry easy you simply navigate to another folder and return […]

Continue reading