Email velocity token | Community
Skip to main content
Level 5
Apr 29, 2020 2:03 PM UTC
Solved

Email velocity token

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.
SanfordWhiteman
SanfordWhitemanAccepted solution
Level 10
Apr 29, 2020 8:20 PM UTC

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.

13 replies

SanfordWhiteman
Level 10
Apr 29, 2020 5:58 PM UTC

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?

Translate
Level 5
Apr 29, 2020 6:24 PM UTC

 

1. created variable $a to store value  and

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

 

Translate
Jay
SanfordWhiteman
Level 10
Apr 29, 2020 6:56 PM UTC

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.

Translate
SanfordWhiteman
Level 10
Apr 29, 2020 4:15 PM UTC

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

Translate
Level 5
Apr 29, 2020 4:36 PM UTC

please share link where I have to check

Translate
Jay
SanfordWhiteman
Level 10
Apr 29, 2020 4:42 PM UTC

 

Translate