Contact Us

AMPScript · SSJS · SQL Developer 20 snippets PDF

The SFMC Code Vault

Twenty snippets for the platform limitations, CRM sync quirks and high-volume operations the docs do not cover.

Where the documentation stops

Marketing Cloud documentation is good at describing what a function does and poor at describing what happens when you use it against real enterprise data. The gap is where most implementation time disappears.

These twenty snippets all come from that gap. Each one exists because a client hit a wall the documentation did not warn about, and the workaround was worth keeping.

The CRM sync quirks

The largest cluster addresses data arriving from Sales Cloud in shapes AMPScript cannot handle directly. The canonical example is the multi-select picklist, which syncs as a single semicolon-delimited string — “Camping;Hiking;Fishing” — so a straightforward IF against it silently matches the wrong things.

The fix is BuildRowsetFromString, converting the delimited string into an iterable rowset you can actually query. The vault covers that pattern and the related sync behaviours that break naive personalisation.

Surviving send time

Send-time is the most constrained context in Marketing Cloud. Script that runs comfortably in a test send can time out when the same logic executes across a large audience, and a single unhandled error can fail the render for the entire send.

Several snippets cover defensive AMPScript — structuring code so one malformed row degrades gracefully instead of killing the send — and SSJS patterns built for volume rather than convenience.

SQL that does the work upstream

The most reliable way to survive send-time limits is to do less at send time. The SQL snippets cover deduplication and suppression as Query Activities, moving work into Automation Studio where it has room to run.

Every snippet is framed the same way: the problem, the solution, then the code — so it is clear what each one is actually for before you paste it.

What’s inside

  • Parsing CRM multi-select picklists with BuildRowsetFromString
  • Handling the semicolon-delimited sync quirk that breaks IF statements
  • High-volume SSJS patterns that survive send-time limits
  • SQL query activities for deduplication and suppression at scale
  • Bulletproofing AMPScript so one bad row cannot kill the render
  • CRM sync workarounds for fields SFMC will not expose natively
  • Every snippet framed as: the problem, the solution, then the code
FormatPDF
Snippets20
LanguagesAMPScript · SSJS · SQL
Size1.05 MB

More from the vault

Want this run against your actual org?

This is the checklist version of work we do in production. If you’d rather we ran it against your live environment, that’s a 30-minute call — no deck, no discovery theatre.

Book a 30-minute technical session