Syntax

Platform.Function.Lookup(deName, returnField, whereFieldNames, whereFieldValues)
4 arguments

Parameters

Name Type Required Description
deName string Yes Data Extension name or external key
returnField string Yes Column name whose value to return
whereFieldNames string|string[] Yes Filter field name, or an array of field names connected with AND logic
whereFieldValues string|array Yes Filter field value matching whereFieldNames; must be an array of equal length when whereFieldNames is an array

Description

Lookup searches a Data Extension for the first row where all filter conditions match, and returns the value of the specified returnField. When no row matches, it returns an empty string "".

When multiple rows match, Lookup returns the value from the first row found (ordering is not guaranteed — use LookupOrderedRows if order matters).

Examples

Basic lookup

var email = Platform.Function.Lookup(
    "Subscribers",      // DE name
    "EmailAddress",     // field to return
    "SubscriberKey",    // filter field
    subscriberKey       // filter value
);

if (email) {
    Write("<p>Email: " + email + "</p>");
} else {
    Write("<p>Subscriber not found.</p>");
}

Multi-filter lookup (AND logic)

var phone = Platform.Function.Lookup(
    "CustomerData",
    "Phone",
    ["FirstName", "LastName"],       // array of filter fields
    ["Carolyn", "Baumgartner"]       // matching array of values
);

Null-safe pattern

Lookup returns "" (empty string) when no match is found — not null:

var status = Platform.Function.Lookup("Users", "Status", "Email", email);

// Check with either !status or === ""
if (!status || status === "") {
    Write("Not found");
} else {
    Write("Status: " + status);
}

In email context

// In email: use personalization variables for subscriber data
var loyaltyTier = Platform.Function.Lookup(
    "LoyaltyProgram",
    "Tier",
    "SubscriberKey",
    _subscriberKey  // built-in personalization variable
);
Variable.SetValue("@tier", loyaltyTier || "Standard");

Lookup with external key

If your DE name contains spaces or special characters, use the external key:

var val = Platform.Function.Lookup("my-de-external-key", "FieldName", "ID", "123");

Common Mistakes

Expecting null instead of empty string:

// ❌ This won't work — Lookup returns "" not null
if (result === null) { ... }

// ✅ Correct check
if (!result) { ... }

Using Lookup for multiple rows: Lookup returns only one row’s value. Use LookupRows for multiple rows.

Case sensitivity: DE names and field names may or may not be case-sensitive depending on SFMC configuration.

See Also