Adobe Campaign, Marketing Automation

Deploy workflow templates with JavaScript

Deploy workflow templates with JavaScript

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.

Leave a comment

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

Similar posts that you may find useful

Adobe Campaign Classic API
Adobe Campaign

Adobe Campaign Classic API

3 minutes read

My grandad used to say, ‘When there is a platform, there is an API.’ The same goes for Adobe Campaign Classic, which was equipped with its own programmable interface. With this, we can access various core functionalities of the platform, adding new integrations and functionalities In a world where mentioning API typically brings REST to […]

Continue reading
SFMC tips and tricks
Marketing Automation, Salesforce Marketing Cloud, SFMC Tips & Tricks

Open a case with salesforce support

less than a minute read

As the title says open a case every time you experience issue or some feature you used on another instance and now is gone. Why open a case? For example when you automation fails with detailed error “Error has occurred”. Simple solution is to “open a case”. Support will tell you exactly what happened. You […]

Continue reading
Link campaign to the delivery send in salesforce marketing cloud
Salesforce Marketing Cloud

Link campaign to delivery send

3 minutes read

Are you aware of Salesforce Marketing Cloud’s additional marketing feature known as Campaign? This tool allows you to group similar journeys together, providing greater organization for your marketing activities. However, one drawback is that the campaign information is not available in the data views. While waiting for a fix from Salesforce, you can establish a […]

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

Proof email was previewed but not received

2 minutes read

There are many possible issues, and I will try to list all those I have come across during my times when I wondered where my email is. Contact is unsubscribed If the contact you are trying to preview an email with is on one of the global unsubscribe lists, or has unsubscribed or bounced status […]

Continue reading
A visually engaging image representing 'SFMC Essentials: What You Need To Know' through digital and futuristic themes, tailored for Salesforce Marketing Cloud. The artwork includes symbols of marketing like graphs, analytics, and communication icons, combined with cloud computing motifs such as cloud shapes and digital network patterns. The color palette features dark blues and blacks, emphasizing the concept of advanced technology. The design is sleek, professional, and tailored to appeal to a tech-savvy audience, with a focus on clarity and visual appeal.
Marketing Automation, Salesforce Marketing Cloud

SFMC Essentials: What You Need To Know

3 minutes read

Let me show you the essentials I use in my day-to-day adventures with Salesforce Marketing Cloud. As we dive into this blog, I’ll share key insights and strategies that have been integral to my journey. I’ll provide you with practical advice for maximizing your experience with this marketing automation platform. Documentation Who wouldn’t guess this […]

Continue reading