I have added email script to pull through custom fields into a table using Mytokens - see below - this lead only has 3 funds - the maximum # of funds is 9.
The details of your other super funds*
Fund name | Member Number | Code |
Fund 1 | 1 | 11 |
Fund 2 | 2 | 22 |
Fund 3 | 3 | 33 |
${lead.otherfundname4} | ${lead.otherfundnumber4} | ${lead.uSI4} |
${lead.otherfundname5} | ${lead.otherfundnumber5} | ${lead.uSI5} |
${lead.otherfundname6} | ${lead.otherfundnumber6} | ${lead.uSI6} |
${lead.otherfundname7} | ${lead.otherfundnumber7} | ${lead.uSI7} |
${lead.otherfundname8} | ${lead.otherfundnumber8} | ${lead.uSI8} |
${lead.otherfundname9} | ${lead.otherfundnumber9} | ${lead.uSI9} |
I need to hide the tokens when the field value is blank so that the table resizes. Can anyone help with this?
#foreach( $fund in [1..9] )
#if( !$lead["otherfundname${fund}"].isEmpty() )
<tr><td>${lead["otherfundname${fund}"]}</td><td>${lead["otherfundnumber${fund}"]}</td><td>${lead["uSI${fund}"]}</td>
#end
#end
Thanks Sanford Whiteman I tried copying and pasting your code above underneath my other email script and it didn't work.
(a) "It didn't work" isn't enough info to go on.
(b) Why would you paste my code underneath your other script? I can't undo the unwanted output from your script. I'm showing you how to create the conditional output: looping over the possible variables and only outputting the non-empty ones.
Sorry, I'm not a developer so finding this challenging. When I replaced the email script with your code, the email populated as per below.
${lead["otherfundname${fund}"]} | ${lead["otherfundnumber${fund}"]} | ${lead["uSI${fund}"]} |
${lead["otherfundname${fund}"]} | ${lead["otherfundnumber${fund}"]} | ${lead["uSI${fund}"]} |
${lead["otherfundname${fund}"]} | ${lead["otherfundnumber${fund}"]} | ${lead["uSI${fund}"]} |
${lead["otherfundname${fund}"]} | ${lead["otherfundnumber${fund}"]} | ${lead["uSI${fund}"]} |
${lead["otherfundname${fund}"]} | ${lead["otherfundnumber${fund}"]} | ${lead["uSI${fund}"]} |
${lead["otherfundname${fund}"]} | ${lead["otherfundnumber${fund}"]} | ${lead["uSI${fund}"]} |
${lead["otherfundname${fund}"]} | ${lead["otherfundnumber${fund}"]} | ${lead["uSI${fund}"]} |
${lead["otherfundname${fund}"]} | ${lead["otherfundnumber${fund}"]} | ${lead["uSI${fund}"]} |
${lead["otherfundname${fund}"]} | ${lead["otherfundnumber${fund}"]} | ${lead["uSI${fund}"]} |
Did you check all 27 of the fields in the right-hand side tree on Script Editor?
Hi there,
Did you work this out as I have the same query and issue I need to solve for a campaign. Can you show me what you did to get it to work.
Many thanks.
See my answer on your other post.