Skip to content

Retrieving custom property values

SubscriberProperty method can be used to retrieve a value of custom subscriber property with given name.

Method signature:

value = SubscriberProperty(name)

To retrieve and display subscriber properties use the following statement – the value is automatically converted to text (string) in the process – regardless of the underlying property type:

${SubscriberProperty('age')}

Value returned by SubscriberProperty('property_name') is always the common object type. However, underlying subscriber property can be of various types, e.g. int, string, DateTime or decimal (Money type).

Since most of the types can be cast to string you can just use:

${SubscriberProperty('age')}

It will display the integer type age (the number) as string (text).

However, if you want to make any changes to the values of variables or to use them in your Dynamic Content logical statements you have to cast them to their appropriate type, e.g.

<if condition="(int)SubscriberProperty('age') > 18">
<p>You are allowed to access R-rated content</p>
</if>

In the example above the age custom property has been cast to int and only then the conditional statement succeeds. If you had forgotten to cast to integer you would have ended up with an error as you can’t directly compare string (or common object) with a number.