Skip to main content
New Participant
April 30, 2020
Solved

Property reference with lead and custom objects

  • April 30, 2020
  • 10 replies
  • 4105 views

I am trying to create property reference with lead standard objects with lead custom objects using variable as a property reference. 

In lead objects, I have only link id named as contactid which is linked to custom objects table name as activity

I want this to be achieved ( $leadobjects.customobjectsPropertyName)

I want to parse entire lead database, using custom objects property name.

Please suggest how can I set variable in this case

 

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 wan to create token as email script with default value zero.

defualt value for those lead/custom objects whose property is either not exists or null.

If this is incomplete statement then I can add only this details: - I have created custom objects with link id i.e. one to many mapping. I am using this custom objects data in email  to display the data for one property total points in such a way that default value display zero always.


I wan to create custom objects with default value zero.


You aren't "creating" Custom Objects in Velocity, only outputting them.

 

Custom Object records do not have a default value. 

 

A Custom Object record has one or more properties. A property does not itself have a default value. The values "" (empty string) and null are valid, assignable (and useful) property values. 

 

You may choose to consider "" and/or null as non-significant values from a output perspective, and to output a constant value instead:

 

 

#set( $DEFAULT_OUTPUT = 0 ) #foreach( $someObjectName in $someObjectList ) #if( $display.alt($someObjectName["somePropertyName"],"").isEmpty() ) ${DEFAULT_OUTPUT} #else ${someObjectName["somePropertyName"]} #end #end

 

 

The above code is still not changing the underlying property values in any way. You are merely choosing to output something special in certain cases.

 

 

10 replies

SanfordWhiteman
Level 10
April 30, 2020

I want to parse entire lead database, using custom objects property name.


I don't understand your phrasing. You can't parse "the entire lead database" in Velocity. When your code is run, you have access to the current Lead/Person object (the one being sent the email) and its linked Custom Object records. Not all  Leads, nor all Custom Object records.

 

This expression $leadobjects.customobjectsPropertyName is basically meaningless. $leadobjects is not an object in Marketo's Velocity context; the singular $lead, which refers to the current Lead/Person record, is a built-in object (a LinkedHashMap to be precise).

 

And the properties of $lead are never properties of Custom Objects, not even of those COs records that are directly linked to the Lead. All properties of $lead are Lead-level properties (including segment membership, which is a property of the Lead).

 

And please, as noted before, don't try to "speak in code" if you're not a coder. Speak in business requirements. That's the only way to get useful help.

 

New Participant
April 30, 2020

For the property custom objects I want to print default value set as 0. Because in email script token default value not working it display custom objects property tag as a token. Hence, please suggest what approach I need to apply or where should I start data parse in custom objects or lead objects to display default value 0.

Jay
SanfordWhiteman
Level 10
April 30, 2020

For the property custom objects I want to print default value set as 0. But in email it display custom objects property tag as a token.


No idea what you mean by this.