Email velocity token | Community
Skip to main content
Level 5
April 29, 2020
Solved

Email velocity token

  • April 29, 2020
  • 2 replies
  • 4905 views

I have created custom objects  named as CO and using custom objects (CO)field as a email script token in email for the field created "role". I want to populate based on condition if part of custom objects display role.

Problem - Using if condition code it jumps to else condition only. 

 

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

I want to check empty value in custom objects(field xyz) as well as empty in lead standard ( i.e. not in custom table).

I am not checking non empty for the field xyz property .

And abc field is link id with lead standard in Marketo. which is related with xyz as a child field.

And for empty value in custom objects field xzy I want to display zero and empty value for lead  standard ( i.e. not in custom table). I want to display zero here also.

For, non empty value field xyz I want to display value in email but no checking is needed only display value.


You just changed your spec: you didn't mention anything about Lead properties before.

 

In any case, the correct way to check whether a property value is empty is, as noted above:

 

#if( $someObject.somePropertyName.isEmpty() )

 

That $someobject could be the built-in $lead or it could be a Custom Object record in your list of Custom Objects, as you're #foreach-ing over the list. When you do 

 

#foreach( $someItem in $someList )

 

then, inside the #foreach, $someItem is automatically set to the current record as you iterate, record [0], record [1], record [2], and so on.

2 replies

SanfordWhiteman
Level 10
April 29, 2020

Please highlight your code using the syntax highlighter (choose Java as the language). Then we'll continue.

Level 5
April 29, 2020

please share link where I have to check

Jay
SanfordWhiteman
Level 10
April 29, 2020

 

SanfordWhiteman
Level 10
April 29, 2020

To begin with, your code isn't valid Velocity. You must have taken empty() from another language. The correct way to check in Velocity/Java is

 

#if( $someReference.isEmpty() )

 

Then you're just gettting the first item in the list of loyaltypoints. Don't you want to check if any items in the list have a non-empty totalActual property? Why would you just check one? And what is supposed to happen if more than one item has a non-empty totalActual?

Level 5
April 29, 2020

 

1. created variable $a to store value  and

2. In if condition checking   value is not empty than print the value 

 

Jay
SanfordWhiteman
Level 10
April 29, 2020

1. in Email Script, I want to print the ${loyaltypoints_cList.get(0).totalActual}  value

Please don't try to express your business requirements in code, as you aren't a coder.

 

Explain in plain language.