Project · Iterable · Salesforce MC · Marketo

One Block Written for Three ESPs

The iD Tech Pathway progress block, written three times: Iterable Handlebars, SFMC AMPscript and Marketo Velocity. The data and the rendered email are the same on every platform, so the only thing that changes is the platform itself. One parent, Priya, has two Pathway students: Maya at level 4 and Theo at level 10.

  • Iterable
  • Salesforce MC
  • Marketo
  • Handlebars
  • AMPscript
  • Velocity
  • Personalization

The Block

Your Pathway progressto priya.k@example.com

Maya · Level 4

3,650 XP · 350 to level 5

Next on the path: Robotics: Sensors & Autonomy

Theo · Level 10

Level 10. Theo’s letter of recommendation is ready. Download the letter

One card per student: the level, progress toward the next one, the XP still to earn and the next course. At level 10 the bar gives way to the letter of recommendation.

Progress is sent, not calculated. The XP service writes progressPct with the XP, so the email, the app and the camp badge always agree.

The same values sit on all three platforms. Names, URLs and numbers are examples.

FieldMayaTheo
Level410
XP3,6509,850
Next level at4,000null
Progress65%100%

The Code, Three Ways

Iterable

Handlebars

Where the data livesAn array of objects on the parent’s profile, profile.students. Typed as nested, so a segment can match level and pathway on the same student. The XP service rewrites the whole array, since arrays replace rather than merge.

What changesBuilt for display. The loop and the level check read straight off the profile, and math and numberFormat cover the small arithmetic.

No students on fileA Journey filter ahead of the send step, rather than a template error.

The block in Handlebars
{{#each profile.students}}
<h2>{{studentName}} · Level {{pathwayLevel}}</h2>
{{#if (eq pathwayLevel 10)}}
  <p>Level 10. {{studentName}}'s letter of recommendation is ready.</p>
  <a href="{{letterUrl}}">Download the letter</a>
{{else}}
  <table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0"><tr>
    <td width="{{progressPct}}%" height="8" bgcolor="#AB9353"></td>
    <td height="8" bgcolor="#E9E5DC"></td>
  </tr></table>
  <p>{{numberFormat pathwayXP groupingUsed=true}} XP ·
     {{math nextLevelXP '-' pathwayXP}} to level {{math pathwayLevel '+' 1}}</p>
  <p>Next on the path: <a href="{{nextCourseUrl}}">{{nextCourse}}</a></p>
{{/if}}
{{/each}}

Salesforce MC

AMPscript

Where the data livesA child Data Extension, Pathway_Students, with one row per student. ParentKey holds the parent’s Subscriber Key.

What changesFetches its own data. One LookupOrderedRows call pulls every student row and the FOR loop prints a card for each. RedirectTo keeps click tracking on links built at send time.

No students on fileRaiseError with its second argument set to true skips this one subscriber. The rest of the send carries on.

The block in AMPscript
%%[
SET @students = LookupOrderedRows("Pathway_Students", 0, "StudentName ASC", "ParentKey", _subscriberkey)
SET @count = RowCount(@students)
IF @count == 0 THEN
  RaiseError("No Pathway students for this parent", true)
ENDIF
FOR @i = 1 TO @count DO
  SET @row   = Row(@students, @i)
  SET @name  = Field(@row, "StudentName")
  SET @level = Field(@row, "PathwayLevel")
  SET @xp    = Field(@row, "PathwayXP")
  SET @next  = Field(@row, "NextLevelXP")
  SET @width = Concat(Field(@row, "ProgressPct"), "%")
]%%
<h2>%%=v(@name)=%% · Level %%=v(@level)=%%</h2>
%%[ IF @level == 10 THEN ]%%
  <p>Level 10. %%=v(@name)=%%'s letter of recommendation is ready.</p>
  <a href="%%=RedirectTo(Field(@row, "LetterUrl"))=%%">Download the letter</a>
%%[ ELSE ]%%
  <table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0"><tr>
    <td width="%%=v(@width)=%%" height="8" bgcolor="#AB9353"></td>
    <td height="8" bgcolor="#E9E5DC"></td>
  </tr></table>
  <p>%%=FormatNumber(@xp, "N0")=%% XP ·
     %%=Subtract(@next, @xp)=%% to level %%=Add(@level, 1)=%%</p>
  <p>Next on the path: <a href="%%=RedirectTo(Field(@row, "NextCourseUrl"))=%%">%%=v(Field(@row, "NextCourse"))=%%</a></p>
%%[ ENDIF ]%%
%%[ NEXT @i ]%%

Marketo

Velocity

Where the data livesA custom object, student_c, on the parent’s lead. Velocity sees $student_cList: the ten most recently updated records, and only the fields checked in the token’s object tree.

What changesValues can arrive as strings, so the script converts XP and level to numbers first. Links keep a literal https:// outside the variable, which is what lets Marketo track them.

No students on fileThe smart list, not the script, decides who gets the email. The #if prints nothing as a backstop.

The block in Velocity
## Email script token {{my.PathwayBlock}} · student_c checked in the object tree
#if( $student_cList.isEmpty() )
## nothing to print; the campaign's smart list already requires a student
#else
#foreach( $s in $sorter.sort($student_cList, "studentName") )
#set( $level = $math.toInteger($s.pathwayLevel) )
#set( $xp    = $math.toInteger($s.pathwayXP) )
#set( $next  = $math.toInteger($s.nextLevelXP) )
#set( $pct   = $math.toInteger($s.progressPct) )
<h2>${s.studentName} · Level ${level}</h2>
#if( $level == 10 )
  <p>Level 10. ${s.studentName}'s letter of recommendation is ready.</p>
  <a href="https://${s.letterPath}">Download the letter</a>
#else
  <table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0"><tr>
    <td width="${pct}%" height="8" bgcolor="#AB9353"></td>
    <td height="8" bgcolor="#E9E5DC"></td>
  </tr></table>
  <p>$number.format("#,##0", $xp) XP ·
     $math.sub($next, $xp) to level $math.add($level, 1)</p>
  <p>Next on the path: <a href="https://${s.nextCoursePath}">${s.nextCourse}</a></p>
#end
#end
#end

Merge Syntax

TaskIterableSalesforce MCMarketo
Print a field{{studentName}}%%=v(@name)=%%${s.studentName}
Fallback when empty{{defaultIfEmpty firstName "there"}}IIF(Empty(@firstName), "there", @firstName)#if( $lead.FirstName.isEmpty() )there#else${lead.FirstName}#end
Condition{{#if (eq pathwayLevel 10)}}IF @level == 10 THEN#if( $level == 10 )
Loop{{#each profile.students}}FOR @i = 1 TO @count DO#foreach( $s in $student_cList )
Arithmetic{{math nextLevelXP '-' pathwayXP}}Subtract(@next, @xp)$math.sub($next, $xp)
Format a number{{numberFormat pathwayXP groupingUsed=true}}FormatNumber(@xp, "N0")$number.format("#,##0", $xp)
Back to Projects

© 2026 Cheyne Mosher. All rights reserved.

Back to Projects