Returns the value of an attribute. The function determines this value using data sources related to the Contact or Subscriber that the message is sent to. These sources include email subscriber profiles, data extension fields, journey entry source attributes, and MobilePush attributes.
This function is a better option than making a direct reference to the attribute because it returns null if no data is found.
Syntax
AttributeValue(attribute)
The AttributeValue() function has one parameter:
attribute (string): Required. The name of the attribute to return the value of.
Usage
This example returns the value of the RewardTierPoints attribute from the sendable data extension associated with the message.
%%[
Var @rewardTierPoints, @rewardTierText
Set @rewardTierPoints = AttributeValue("RewardTierPoints")
/* If there's no value for RewardTierPoints in the sendable data extension,
the AttributeValue() function returns null rather than causing the email
send to fail. You can then handle the situation where the value is null. */
If empty(@rewardTierPoints) Then
Set @rewardTierText = "You haven’t registered yet. <a href='https://example.com/signup'>Sign up today</a>!"
Else
Set @rewardTierText = Concat("You have ", @rewardTierPoints, " points.")
EndIf
]%%
<p>%%= v(@rewardTierText) =%%</p>