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.