Blog

Software tips, techniques, and news.

Salesforce Marketing Cloud Connect: Sync Data Back to Sales and Service Cloud

Salesforce Marketing Cloud Connect excels at getting data into Marketing Cloud from Salesforce Sales Cloud or Service Cloud, but is limited in what it automatically syncs back to them. By utilizing some of the more advanced tools in the Marketing Cloud Connect toolbox, you can sync back whatever customer data, business data, or marketing data you want from Marketing Cloud to Sales or Service Cloud. This ensures your organization has a single view of the customer, making it easier to manage customer journeys across platforms. This also means your organization can view whatever detailed information in Sales or Service Cloud that best fits you and your unique business needs, helping you maintain ease of use across the entire system.

youtube-preview

How Marketing Cloud Connect Works

Like all connections in Marketing Cloud Connect, you need to use the Sales or Service Cloud org IDs to update information from Marketing Cloud. As we discussed in our previous article, making sure you have cleaned Marketing Cloud of duplicate contacts with a subscriber key migration will make it much easier to pass the correct information to the correct contact in Sales or Service Cloud.

To actually pass data back to Sales or Service Cloud, you’ll need to use Marketing Cloud’s native scripting language: Ampscript. Ampscript was designed as a coding language that average users could use to include personalized, dynamic content in emails. This means Ampscript is relatively easy to learn and, in fact, updating data in a Sales or Service Cloud object is a single built-in function: UpdateSingleSalesforceObject().

Example Ampscript to Update Salesforce Object.

At the moment, Marketing Cloud doesn’t allow Ampscript to be run directly within an automation, so you'll need to house the code that actually passes information to Sales or Service Cloud in a content block. Content blocks and cloud pages are designed to run any combination of Server Side Javascript (SSJS), Ampscript, and HTML, which makes them very versatile. You should test SSJS or Ampscript code in a cloud page first to troubleshoot your code because Marketing Cloud doesn't have a built-in development platform or debugger. Cloud pages will run your code as soon as they are previewed or loaded and can output custom log messages directly to the screen, acting as a console.

Example log result by using a cloud page preview.

Automations don't allow Ampscript to run in them, so to automate the syncing process, you'll need to use SSJS. Once you have validated your Ampscript in a cloud page, you can put it into a content block and call it with the SSJS function Platform.Function.ContentBlockByID(). By loading the content block, the automation will execute the Ampscript code and update the desired object(s) in Sales or Service Cloud, and you will have automatic synchronization of data from your Marketing Cloud instance!

Tips and Tricks

Automations will halt if the Ampscript encounters an uncaught error (just like SSJS), even though the Ampscript is being called through a content block. To make sure you can control when the automation stops and what it does with errors, you need to leverage the use of SSJS try-catch blocks to capture errors. Since content blocks allow you to incorporate both SSJS and Ampscript together, you can accomplish this by wrapping Ampscript in SSJS.

Example of using SSJS to catch Ampscript errors.

Depending on what information you are syncing back to Sales and Service Cloud and how important it is that you know what wasn’t synced back, you can also consider sending email notifications out about the failure through Triggered Sends.

Conclusion

Syncing data back to Sales or Service Cloud from Marketing Cloud is a hugely powerful feature of Marketing Cloud Connect. The ability to pass custom data back, in addition to the built-in tracking data, makes it all the more useful. Our last article in this series will touch on one last way to expand the base functionality in Marketing Cloud Connect: previewing a full-resolution email from a Marketing Cloud send in Sales or Service Cloud. For help setting up a Marketing Cloud Connect configuration to sync custom data to your Sales or Service Cloud, please contact us.

Need help with your Salesforce digital transformation? Contact us today to discuss Salesforce consulting, implementation, development, and support!

Download the Salesforce Object SSJS and Ampscript

Please complete the form below to download your FREE Salesforce file.

First Name *
Last Name *
Company
Email *
Phone *
SalesForce Experience *
Agree to Terms *
nathan kiefer headshot.
Nathan Kiefer

Nathan is a Certified FileMaker Developer and Salesforce consultant with a warm and accommodating approach to delivering high quality results. Personable and empathetic, he is dedicated to being a supportive team member to both clients and colleagues.