SFMC | Automation run on loop

in  Automation studio, Salesforce Marketing Cloud
2 minutes read

We all know very well, that automation can be scheduled the minimum-you-can-set once per an hour. This may satisfy mostly of automation we might build in our automation studio but sometimes we want to run automation again and again just as it finishes its previous run.

To achieve that we will create while loop with two automation where one automation is the main worker and does all the work you need it to do and the other will just call back the worker automation to start processing again.

This is very useful in many cases where you want to process Data Extensions with millions and millions of row and if you process all at once it will most likely end up into a run timeout.


Add following columns to data extension that will be processed in batches:

  • processed as Boolean
  • processed_at as date

Worker automation

Main automation that will process Data extension with a lot of data will consists of following activities.

  • query activity to take portion of data from the data extension you want to process in loop
  • verification activity – to finish automation while loop when there is no data to process
  • activities to process actual records taken into actual loop
  • mark records as processed so they wont be processed again in the original data extension
  • call the caller – this is script using to call other automation. For this you can find wast examples on the internet. You can achieve same with WSProxy or with platform function InvokePerform. Example can be found on stackexchange.
//InvokePerform simplified example
var obj = Platform.Function.CreateObject("Automation");
Platform.Function.SetObjectProperty(obj, "ObjectID", ObjectID);
var po = Platform.Function.CreateObject("PerformOptions");

var performResult = [0,0,0];
var performStatus = Platform.Function.InvokePerform(obj, "start", performResult, po);

//ws proxy sipmlified example
var WSProxy = new Script.Util.WSProxy();
WSProxy.performItem("Automation", { CustomerKey: customerKey }, "start");

Caller automation

Caller automation will consist of wait activity to make sure our worker automation is finished before we called it back to run again. And the script itself that runs the worker automation with method described earlier.

Good to know

Do not configure scheduler leave it blank. If you do so the automation could not be called from script

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

SFMC TIP | Google Analytics Integration 1

less than a minute read

When you integrate with Google Analytics, marketing cloud will add tags to all your links. When this happens, all dynamic links will be broken. Links that are defined programmatically as variable, field or attribute with GA integrated will look as if the tracking link also appends google analytics tags. This will make such link not […]

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

SFMC TIP | Open a case

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
in  Marketing Automation, Salesforce Marketing Cloud, SFMC Tips & Tricks

SFMC TIP | Data views for transactional emails

1 minute read

Data views in Salesforce Marketing Cloud are very handy, when it comes to getting data insights from various sources inside the platform. I will give you a quick start on how to get data insights for you transactional emails using data views. We will use data from _Sent, _Job, and _Subscriber view s.TriggererSendDefinitionObjectID – object […]

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

SMFC TIP | NULL value comparison in IF statement

less than a minute read

If you have field in DE that its value is not always populated for a particular row (customer) and you test field value against any value cloud page will throw an 500 – internal server error. To fix this you will need to add another AND-condition to test field value for NULL

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

SFMC TIP | Invalid links in HTML

1 minute read

When the HTML template is used (loading your own HTML code) all the links that use query parameters (?a=b) will resolve to invalid links when they redirect upon user click. This happens when web analytics UTM tags are being attached to the delivery. To resolve this issue all the links with additional query parameters has […]

Continue reading
in  Salesforce Marketing Cloud

SFMC | Link campaign to delivery send

3 minutes read

Hope we will live up to the day when the campaign information will be available in the data views but until that day comes we would need to do following, to establish such link inside Salesforce Marketing Cloud. Get campaign list To get campaign list we need to use REST API to get all campaign […]

Continue reading
in  Marketing Automation, Salesforce Marketing Cloud

SFMC | Multi-cloud preference center

5 minutes read

With majority of the implementations the out of the box center is not sufficient for the client and we are tasked to build custom preference center for them. We can assume that the preference center is only applicable for known subscribers most likely coming from email communication.  When we send email in salesforce marketing cloud, […]

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

SMFC TIP – Form submission handling

1 minute read

On many occasions when handling any form submission single cloud page application is used. This is great as all of error handling, form submission and processing is on one page so it is actually simpler to implement. But here are some thing you need to take into consideration. Handle GET form submissions I have seen […]

Continue reading