Marketing Cloud Connect excels at getting data into Marketing Cloud from 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 data you want from Marketing Cloud to Sales or Service Cloud. This means your organization can see whatever information in Sales or Service Cloud that best fits you.
How Marketing Cloud Connect Works
Like all connections in Marketing Cloud Connect, you need to use the Sales or Service Cloud IDs to update information from Marketing Cloud. As we discussed in our last 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 dynamic, personalized information into 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().
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.
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.
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.
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 Marketing Cloud Connect 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.