Okay, I know what you are thinking. Propercase() is for formatting names. Uppercase() is great for CTA Button text. But… when am I going to need to adjust something to be all lowercase?
Well, unlike it’s Propercase and Uppercase siblings – lowercase is not used as much when it comes to formatting text strings for display within your email. But I use it all the time.
Picture this – You have some data that you will be using to set up your dynamic content. Pretty standard, right? The big question is – where is that data coming from? And even more important, what kind of shape is your data in? It is easy to find examples where the data we are being asked to use is, well for lack of a better word, a disaster. So what can you do?
I use lowercase() to normalize my values as a way of future proofing my code.
Think about it. Data could be something you are capturing and using, but it may also be passed over to you via someone else’s code. And that code may have gone through multiple revisions, releases, and/or developers. When you’re the developer it is easy to standardize formats of variable names and values. But you can’t be expected to do everything for every project. (You do have to sleep eventually.) So work in tandem with your developer to identify the format the data will come over as. But what if you lose that developer? Where one dev may pass the variable in one way, it could be completely different for someone else.
Why is this important? Many AMPscript functions are CASE-SENSITIVE.
This means that it will read the following variables as completely different, even though they are the same word. For Example:
(Okay the chances of seeing the last option is pretty slim, but the issue still stands.)
Boolean values are one of the most common places where I have seen this issue. They may be passed as all lowercase or all uppercase, depending on where the data is coming from.
Well, here is where lowercase() comes in – I can use it to transform the data I am using so that no matter what case it comes over in, my AMPscript will handle it with ease.
DEFINITION OF PARTS —
STRING = This is the string you want to be changed. It can be passed as a @variable or in “string format”
LowerCase(“jane doe”) → jane doe
LowerCase(“JANE DOE”) → jane doe
LowerCase(“jaNe dOe”) → jane doe
LowerCase(“jane asked a question”) → jane asked a question
Advanced Example 1 – AMPscript Block:
%%[ VAR @IsSkyBlue set @IsSkyBlue = [IsSkyBlue] set @IsSkyBlue = LowerCase(@isskyblue)if @IsSkyBlue=="true" then set @text="Yes the sky is blue" else then set @text="The sky is not blue" endif
Salesforce Developer – LowerCase()