KEMBAR78
AMPscript Best Practices | PDF
0% found this document useful (0 votes)
107 views7 pages

AMPscript Best Practices

The document outlines best practices for writing AMPscript in Salesforce Marketing Cloud. Key recommendations include organizing code with indentation, using clear and descriptive names for objects and variables, maintaining consistent capitalization, choosing appropriate code editors, and taking a patient approach to coding. Following these guidelines can help prevent errors and improve code maintainability.

Uploaded by

Saeesh Nayak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
107 views7 pages

AMPscript Best Practices

The document outlines best practices for writing AMPscript in Salesforce Marketing Cloud. Key recommendations include organizing code with indentation, using clear and descriptive names for objects and variables, maintaining consistent capitalization, choosing appropriate code editors, and taking a patient approach to coding. Following these guidelines can help prevent errors and improve code maintainability.

Uploaded by

Saeesh Nayak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

© STUDYR.

ORG
AMPscript
For Salesforce Marketing Cloud

Best Practices
© STUDYR.ORG
Best Practices
Be organized

As you will see, your code can become quite long quite quickly.
Indenting* your code makes it easier to troubleshoot.

*Indentation involves using the same width of whitespace before each line of a group of code
so that they appear to be related.
© STUDYR.ORG
Best Practices
Be literal

When naming objects and variables, don’t take shortcuts*. In a few


years time, when your code breaks and you need to fix it urgently,
will you remember what the acronym ‘clls’ was supposed to mean?

* Rule of thumbs is:


No acronyms.
No abbreviations.
No approximations.
No spaces.
© STUDYR.ORG
Best Practices
Be case consistent

AMPscript is NOT case sensitive, it will understand @firstname and


@FirstName as the same object. But other programs coming into
play further down the road, like SSJS, will not and inconsistent
capitalisation can cause headaches.
© STUDYR.ORG
Best Practices
Be Picky

When your code becomes very long, you will be tempted to edit it
outside of Marketing Cloud.
Make sure you pick a Code Editor (like VS Code, Brackets) and not a
Text Editor to do so. Text editors tend to use fancy quotes that will
confuse Marketing Cloud – and break your code.
© STUDYR.ORG
Best Practices
Be Patient

Writing code shouldn't be a sprint, it's more like a stroll through the
park. So, proceed with care, test often – one line at a time if possible
– to catch bugs early
© STUDYR.ORG
Good luck!

You might also like