Email script to hide fields when value is blank | Community
Skip to main content
New Participant
November 6, 2017
Question

Email script to hide fields when value is blank

  • November 6, 2017
  • 2 replies
  • 3631 views

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?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

Kirstie_Olah
New Participant
October 16, 2020

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.

SanfordWhiteman
New Participant
October 16, 2020

See my answer on your other post.

SanfordWhiteman
New Participant
November 6, 2017

#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

sdutoit-2Author
New Participant
November 6, 2017

Thanks @Sanford Whiteman​ I tried copying and pasting your code above underneath my other email script and it didn't work.

SanfordWhiteman
New Participant
November 6, 2017

(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.