SOLVED

Re: If JS Token Returns Value=null, collapse entire block?

Go to solution
Kelsey_Hope
Level 2

If JS Token Returns Value=null, collapse entire block?

Hello,

We have a JS Token that we use in our Marketo emails. When the result is null we set the default text to direct users to contact our customer service team. However, we would like to change this so that the entire block of content disappears when the result is null. Can this be done?

1 ACCEPTED SOLUTION

Accepted Solutions
Grégoire_Miche2
Level 10

Re: If JS Token Returns Value=null, collapse entire block?

A JS token in an email ? You mean a velocity token ?

It will not be possible to change the block presence, unless the block IS the token. In velocity, you can output all the html you need, so this should be possible. You will have to:

  • move the whole block HTML to the token
  • Make the whole code conditional
  • create a specific block in you email template that has no border and a 0 default height which only content will be the token.

-Greg

View solution in original post

5 REPLIES 5
Grégoire_Miche2
Level 10

Re: If JS Token Returns Value=null, collapse entire block?

A JS token in an email ? You mean a velocity token ?

It will not be possible to change the block presence, unless the block IS the token. In velocity, you can output all the html you need, so this should be possible. You will have to:

  • move the whole block HTML to the token
  • Make the whole code conditional
  • create a specific block in you email template that has no border and a 0 default height which only content will be the token.

-Greg

Kelsey_Hope
Level 2

Re: If JS Token Returns Value=null, collapse entire block?

Thank you, this is very helpful! Do you think this is something that someone with a passing experience with HTML could do, or would it be better to contract some hours with Marketo to do this?

Grégoire_Miche2
Level 10

Re: If JS Token Returns Value=null, collapse entire block?

Better have someone skilled in Velocity.

Marketo consultants is not the only source of skills, there some partners and freelances that can help you too.

-Greg

SanfordWhiteman
Level 10 - Community Moderator

Re: If JS Token Returns Value=null, collapse entire block?

If you post your existing Velocity token it may be solvable here. Just make sure you use the Advanced Editor's syntax highlighter (highlight it as Java, since there's no Velocity option and Java is the closest) or it won't be readable:

pastedImage_2.png

Be warned that if the existing code is really bad (as in not following VTL best/reliable practices) then it won't be feasible to spot-fix. Hopefully, it's OK but is missing a simple condition.

SanfordWhiteman
Level 10 - Community Moderator

Re: If JS Token Returns Value=null, collapse entire block?

And also please open a new thread since you already (appropriately!) marked Greg's response as the Correct one and he deserves to keep it.