Hello,
How can I add a default value to my firstName personalization in my email, such as "Valued Customer" if firstName is empty? Right now, it shows as a blank space followed by a comma).
<span class="nl-dce-field mobile_header_text nl-dce-done" id="span161662637290731" data-nl-expr="/context/profile/firstName" data-nl-type="string" data-contenteditable="false" data-nl-format="datetime">First name (firstName)</span>
Thanks in advance.
Terri
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
you could define a dynamic content and then use a condition "firstname is not empty" and the default value
Views
Replies
Total Likes
I would go with Ramon's solution, but you could use a content block as well.
Here is the code of one we have already in place in our ACS:
<%
// Displays a greeting formula appropriate for the profiles' fields
// populated in the database (first name, last name and title)
// The following table defines the formula to use in each case
// (#0 is replaced with the title, #1 with the first name and #2 with the last name)
var aGreetings = // **bleep** Fir Las
['Hello,' , //
'Hello,' , // X
'Hello,' , // X
'Hello #1 #2,' , // X X
'Hello #0,' , // X
'Hello #0 #2,' , // X X
'Hello #0,' , // X X
'Hello #0 #1 #2,']; // X X X
var aField = [context.profile.salutation, // field corresponding to #0
context.profile.firstName, // field corresponding to #1
context.profile.lastName]; // field corresponding to #2
var iIndex = 0, iCount = aField.length;
for( i=0 ; i<iCount ; i++ )
{
if( aField[i] != '' )
iIndex += Math.pow(2,(iCount-i-1));
}
var sToDisp = aGreetings[iIndex];
sToDisp = sToDisp.replace(/#0/, aField[0]);
sToDisp = sToDisp.replace(/#1/, aField[1]);
sToDisp = sToDisp.replace(/#2/, aField[2]);
document.write(sToDisp);
%>
You can use the code above and modify it to only use the first name if exist.
Views
Replies
Total Likes
Views
Replies
Total Likes
Views
Likes
Replies