Перейти к содержимому

Checking if custom property exists

If you’re using custom subscriber properties you should be aware of the fact that subscriber properties can be potentially null – it means that the value of the subscriber property has not been set for a particular subscriber – it’s different than 0 values or empty strings.

Performing various operations on null values (such as casting) can result in an error, therefore it is a good idea to check if a particular custom property was set for a subscriber first, using SubscriberHasProperty method.

Method signature:

hasProperty = SubscriberHasProperty(name)

This method will check if the particular property has been set for a subscriber and return boolean (true/false) value that can be used in logical statements:

<if condition="SubscriberHasProperty('age')">
  <p>We know your age!</p>
</if>