background shape
background shape

Salesforce Marketing Cloud tips in 2024

Working with marketing automation platforms for almost a decade and over 4 with salesforce marketing cloud have taught me valuable lessons on how to approach problems we all face in our daily lives as marketing automation consultants.

The first and most important tip is to open a support case whenever you’re struggling with an issue and can’t find any relevant documentation or when the error log doesn’t provide enough information to resolve the problem. Seeking help early on can save you a lot of time and frustration, as support teams often have access to resources and insights that aren’t publicly available. They can see far beyond what you can within your system, especially when they have access to the full error log details. This broader perspective allows them to guide you through complex problems, offer solutions you might not have considered, and help you get back on track more quickly.

Data extensions

One of the core features of Marketing Cloud is data extensions. When you work with the tool, you cannot avoid using them from day one. Here are some of my best tips that help me navigate the platform’s UI traps on a daily basis.

Import / export data

I have encountered same issue, with rejected lines, when exporting data from data extension in contact builder and then importing the same freshly exported data. Since then I do only import data in email studio. Exporting works just as good on both email studio and contact builder.

Refresh data in data extension

Sometimes, very basic features are lacking on the platform, such as a simple data extension refresh option to get newly committed changes when you are waiting for an import or query activity to insert or update rows in your data extension. In Email Studio, you can refresh the data by simply navigating to another folder and then back. A better way to refresh data is from Contact Builder by changing the pagination or by setting and resetting a filter.

Emails studio vs contact builder

When comparing the legacy feature (Email studio) versus the new feature (Contact builder) for contact or data organization, it’s essential to evaluate which one is better and what scenario to use each. Here is my take on when to use each feature:

In general, or from my experience, Email Studio loads faster than Contact Builder. However, Email Studio is very limited in terms of data exploration.

Email Studio

  • Pros: Faster loading times, ability to create and edit fields in bulk, and access to tracking information.
  • Cons: You cannot access data retention settings, there is no pagination, and you can only see the first 200 records.
  • Best Use: When you need quick access to data structure or to change/add more fields at once.

Contact Builder

  • Pros: Pagination, search feature (limited to primary keys), and attribute groups for setting up a data relationship model.
  • Cons: Slower loading times compared to Email Studio, and you can edit/add only one field at a time.
  • Best Use: For quick searches, traversing data, or setting up data retention.

Errors when saving data extensions

On a normal day, if you try copy a data extension and encounter a generic error message, it is most likely because a data extension with the same name already exists in your Business Unit (BU).

Error:Failed to initiate Data Extension Copy

We encountered the same issue previously when creating a data extension with the same name. However, it appears that Salesforce has finally resolved this problem and now provides a meaningful error message.

Error: Data Extension already exists with that name

Errors when changing data extension name

Trying to change a data extension name? Are you getting Error: Error updating filter? Another very self explanatory error description that keep even seasoned consultant puzzled.

The solution is very simple: you need to look at the “Policies” and allow the particular data extension to be modified. In Email Studio, you need to check the “Allow users to delete this Data Extension” option in order to make any changes to its name. Interesting, right? It can’t get more confusing than this.

Manage data extension policies in email studio of marketing cloud

Copying data extensions

Primary keys and default values are not copied over when copying data extension based on a existing data extension in create feature.

Create data extension based on another causing primary keys information not copied over.

A better way to copy a data extension is to simply open it and click on “Copy.” This ensures that all the primary keys and other settings are copied correctly. This method is straightforward and minimizes the risk of errors, preserving the integrity of the data extension’s structure and configurations.

Copy data extension feature

Cloud pages

Landing pages, or Cloud Pages, are another core functionality provided by Marketing Cloud. They allow us to set up various pages for lead capture, surveys, custom preference centers, or any other product landing pages as needed.

Problems with cloud page content cache

If you’ve ever built anything on a cloud page, you might have noticed that it takes a while for your changes to propagate and become visible on the site. This delay, at least for me, led to significant confusion when debugging issues—sometimes I had already fixed a problem, but the page still displayed an outdated version of my script. The root cause of this delay is server caching, which stores the content of your cloud page and doesn’t immediately reflect updates.

To avoid this frustration, a better approach is to develop your cloud page using a code snippet that can be dynamically loaded onto the cloud page. By doing so, you can update your code more efficiently, with changes taking effect immediately without being hindered by caching. This method removes the pain from the cloud page development process, reducing the time spent on troubleshooting and ensuring that the most recent version of your code is always displayed.

After you’ve completed development, it’s a good practice to copy your functioning code snippet directly into the cloud page. This allows you to take advantage of the server’s caching feature, which can significantly improve the page’s load times and overall performance for end users.

%%=treatascontent(ContentBlockByName('my-nice-cloud-page'))=%%

Client side JavaScript in code snippets

Another particularly mind-boggling issue you might encounter while navigating the deep waters of Marketing Cloud is related to developing your cloud page within a code snippet and trying to add client-side JavaScript. Marketing Cloud, in its attempt to ensure security, will automatically strip out any client-side JavaScript that you include within your code snippet. This behavior can be incredibly frustrating because it may take you a while to realize that your JavaScript is being mercilessly removed every time you save the snippet.

This issue often leads to confusion, as you might spend significant time debugging and wondering why your JavaScript isn’t functioning, only to discover that it’s being erased by the platform.

To resolve this issue, you can “fool” Marketing Cloud by splitting the script keyword into multiple AMPscript print statements. This technique prevents Marketing Cloud from recognizing and stripping out the client-side JavaScript. Here’s how you can do it:

%%=Concat('<','scr','ipt>')=%%
  //your client side javascript
  var 1plus1 = ()=>1+1
%%=Concat('</','scr','ipt>')=%%  

Automation studio

Extract data extension

When we extract data from Marketing Cloud, which we do on almost every occasion, I have found one thing to be particularly useful: making the data extension’s external key the same as its name. This practice is especially beneficial when trying to identify the data extension we are extracting. Although it may sound ridiculous, Salesforce did not think of this simple feature that would remove some of the hassle involved in figuring out which data extension we are extracting when the default external key is used.

Extract activity data extension settings in Automation Studio of Salesforce Marketing Cloud

Avoiding timeouts in queries

Good old timeouts, everytime your query takes 30 minutes we will get rewarded with timeout error. To address this issue first you might take a look at the query itself and optimize it where you can.

Optimize, optimize, optimize

Salesforce gives you a warning when your query is not well-optimized and suggests considering optimization. Try to address all the warnings it provides upon clicking on Validate syntax.

Salesforce marketing cloud SQL suggestions

If you feel that you have tried your best and are still getting timeouts, you can read further.

Adding indexes to data extension

Indexes are designed to make data retrieval more efficient by providing a faster way to look up records without scanning the entire table. This index helps the database engine quickly locate and join the relevant rows, thus speeding up query execution.

There are no indexes in Salesforce Marketing Cloud. However, consider yourself lucky because we can add primary keys to all columns, and when a primary key is added to a column, it automatically creates an index for that column.

Cannot add indexed field add primary key instead

Remove unnecessary columns

Removing unnecessary columns that are not used in the automation can significantly reduce the data load being processed, thereby speeding up query run times. This is because the database engine has fewer columns to read and write, which enhances overall performance and efficiency. You can bring the columns back after completing the heavy database operations to restore full functionality.

For instance, a study by Vertabelo showed that optimizing database schemas by removing unused columns can lead to performance improvements in query execution times and resource usage. This approach is also recommended in best practices for database optimization by industry experts, such as those from Oracle and Microsoft SQL Server.

Split the load

When nothing else helps and we are still experiencing timeouts on our queries, a last resort can be to split the load into multiple smaller chunks. This approach can help manage the workload more effectively and prevent timeouts by processing smaller, more manageable batches of data sequentially or in parallel.

MOD

The simplest way how to do it is to use good ol’ MOD – modulo or remainder of the division.

The term MOD stands for “modulo,” which is a mathematical operation. The modulo operation finds the remainder of the division of one number by another. In SQL and other programming languages, the MOD function is used to perform this operation.

SELECT
    *
FROM
    CustomerData
WHERE
    _CustomObjectKey % 5 = 0
  /* 
  _CustomObjectKey % 5 = 1
  _CustomObjectKey % 5 = 2
  _CustomObjectKey % 5 = 3
  _CustomObjectKey % 5 = 4
  */

Using MOD:

  • The MOD function is used to calculate the remainder of _CustomObjectKey when divided by 10, effectively splitting the data into 10 groups.
  • This method is straightforward and allows for direct filtering in the WHERE clause.

When to use MOD:

  • Simplicity and Performance: If you need a simple and fast way to partition data and you are confident that the distribution of _CustomObjectKey values will not lead to significant imbalances.
  • Manual Control: When you prefer or need to manually control and process each partition separately.
NTILE

If you want to be taken more seriously or puzzle more of your colleagues, you can use NTILE to make everybody think you are a SQL wizard.

SELECT
    *
FROM
    (
        SELECT
            *,
            NTILE(5) OVER (ORDER BY _CustomObjectKey) AS PartitionNumber
        FROM
            CustomerData
    ) AS PartitionedData
WHERE
    PartitionNumber = 1
    /*
     PartitionNumber = 2
     PartitionNumber = 3
     PartitionNumber = 4
     PartitionNumber = 5
    */

Using NTILE:

  • The NTILE function divides the result set into a specified number of roughly equal groups.
  • In this example, NTILE(10) splits the data into 10 groups, with each group having an approximately equal number of rows.

When to use NTILE:

  • Even Distribution: If it is crucial to have evenly distributed partitions to avoid overloading any single partition.
  • Automated Management: When you prefer automated partitioning to reduce manual effort and ensure consistency.

Avoiding timeouts in Script activity

To handle the 30-minute runtime limit in Server-Side JavaScript (SSJS) within Marketing Cloud’s Automation Studio, consider breaking down tasks into smaller jobs, using timers to monitor elapsed time, and processing data in batches. These strategies help avoid hitting the time limit and manage failures effectively, optimizing your automation scripts.

Open automation on a new tab

I learned this trick very recently when I had to amend a lot of automations. To my surprise (or not), when you navigate back from the automation view, you are not taken back to the folder from where you opened the automation but back to the beginning. This makes navigating back and forth between many automations very unpleasant.

The remedy for fixing this UI bug is nowhere near from Salesforce itself, but in the meantime, we can use a simple workaround:

“Open the automation in a new tab.”

Testing SSJS with cloud page

When I’m developing something that I plan to use later within an automation, I prefer to carry out my development activities within a cloud page. This approach allows me to see immediate results and easily print any information or error messages without the hassle of running an automation and waiting for it to start or provide a meaningful error message.

By working in a cloud page, you can quickly test and debug your code in real-time, making it much easier to catch and resolve issues early on. This method saves time and reduces the frustration that often comes with waiting for automations to run and deciphering their sometimes vague error logs. Once the code is perfected, you can then integrate it into your automation with confidence.

Also, keep in mind that you won’t be able to run your code within the browser for an extended period. If your cloud page takes longer than 30 seconds to execute, it will time out, resulting in an error, and you won’t gain any insights or see the results of your code.

When processing a large amount of data or making multiple function calls within loops, it’s a good idea to use break; within your loops to limit the processing to just one iteration during testing. This allows you to quickly check the logic of your code without running into timeouts or having to wait for the entire process to complete. Once you’re confident in the results, you can remove the break; statement and let the full loop run. This approach helps you avoid unnecessary delays and ensures that your code is working as expected before moving on to more extensive data processing.

Preview activities in activated automation

You’re probably familiar with this small pain point when working with Salesforce Marketing Cloud: it won’t let you open the details of activities within an automation while it’s scheduled. This limitation can be particularly frustrating when you need to review. Fortunately, there’s a simple workaround—just copy the automation. By duplicating it, you can access and preview all the activity details without any restrictions.

Once you’re done reviewing, be sure to delete the copied automation to keep your workspace organized and without messy bloat.

Email studio

Refresh email template in running journey

This issue often occurs during content updates: you make your changes, but the updated content doesn’t reflect in the actual email send. This happens because the journey or workflow system caches the email templates. Once the journey is in progress, it continues to use the cached version of the templates, which means any updates won’t be applied until the journey is restarted or the cache is manually cleared. This caching mechanism is intended to optimize performance but can lead to discrepancies if content is updated mid-journey.

Refresh cache of single template

You can manually refresh template by opening it within journey builder

  • open the email activity
  • select in drop down “Activity summary”
  • “Preview & Test” or “Select different message” – either preview it with contact or reselect same message
  • Reselect message and click “Done” or go back when in “Prieview & Test” after you personalized the template

This will refresh the template cache in the running journey.

Refresh cache of all templates using suppression list

You can refresh all the templates in your business unit by simply creating and publishing a suppression list. This action forces a rebuild of the template cache, ensuring that the latest updates are applied across all email sends.

Refresh cache of all templates using SFMC DevTools

If you prefer using VS Code or console-like commands to interact with Marketing Cloud, you should check out the SFMC DevTools. These tools offer a wide range of functionalities, including the ability to refresh the cache of email templates.

mcdev re MyProject/_ParentBU_

You can find more great ideas on how to refresh template content on a dedicated Stack Overflow forum post. This resource can provide additional methods and tips from other developers who have faced similar challenges in Marketing Cloud.


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.

Share With Others

Leave a Comment

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

MarTech consultant

Marcel Szimonisz

Marcel Szimonisz

I specialize in solving problems, automating processes, and driving innovation through major marketing automation platforms.

Buy me a coffee