GetValue
This function returns the value of the specified Subscriber attribute or AMPscript variable.
Argument
GetValue(1)
Ordinal | Type | Required | Description |
---|---|---|---|
1 | String | True | Subscriber attribute or AMPscript variable from which to return a value |
NOTE: The function is prefixed with an
Attribute
object to retrieve Subscriber attributes (either Attribute Strings or System Strings) or aVariable
object to retrieve AMPscript variables. Prefixing AMPscript variables with an@
character is optional.
Example 1
%%[
var @firstName
set @firstName = AttributeValue("firstName") /* value from attribute or DE column in send context */
set @firstName = "Leon" /* or a literal value */
]%%
<script runat="server">
Platform.Load("core","1.1.5");
var firstName = Variable.GetValue("@firstName");
Write("<br>firstName: " + firstName);
</script>
Output
firstName: Leon
Example 2
<script runat="server">
Platform.Load("core","1.1.5");
var firstName = Attribute.GetValue("firstName");
var sk = Attribute.GetValue("_subscriberKey");
var email = Attribute.GetValue("emailaddr");
var jobid = Attribute.GetValue("jobid");
Write("<br>firstName: " + firstName);
Write("<br>subscriberKey: " + sk);
Write("<br>email: " + email);
Write("<br>jobid: " + jobid);
</script>
Output
firstName: Leon
subscriberKey: 0032v0000313dgcXYZ
email: leon@limedash.com
jobid: 12345