Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

The 4th edition of the Campaign Community Lens newsletter is out now!
SOLVED

Email header masks

Avatar

Level 2

I am loading personalized mask values for "from name", "reply to address" and "reply to name" & have been able to reference the additional data to populate these values in place of the defaults.   My dilemma is that my client wants to populate with the personalized masks where they are not null and populate with defaults where null. 

I *think* I need to create new content blocks for these but don't know how to create a content block for temp workflow data...  can I write the  if statement with
If ((targetData/fieldname) is empty, 'default content block',(targetData/fieldname)) ??

1 Accepted Solution

Avatar

Correct answer by
Level 4

yes you can build your logic in content block as

 

<%

var fieldName = context.targetData.target.fieldname;

var defaultValue = ‘default’;

%>

<%

if (fieldName.length > 0) {%>

   <%=fieldName%>

<%}

else {%>

  <%=defaultValue%>

<%}

%>

 

Please try this out and let me know.

 

 

 

1 Reply

Avatar

Correct answer by
Level 4

yes you can build your logic in content block as

 

<%

var fieldName = context.targetData.target.fieldname;

var defaultValue = ‘default’;

%>

<%

if (fieldName.length > 0) {%>

   <%=fieldName%>

<%}

else {%>

  <%=defaultValue%>

<%}

%>

 

Please try this out and let me know.