Verification in progress Differs from official docs Test scripts included

Syntax

LookupRows(dataExt, searchColumn1, searchValue1[, searchColumnN, searchValueN, ...])  →  rowset

Parameters

Name Type Required Description
dataExt string Yes Name or external key of the data extension to read
searchColumn1 string Yes First column to filter on
searchValue1 string | number Yes Value the first column must equal
searchColumnN string No Further filter columns, each paired with a value
searchValueN string | number No Value the corresponding further column must equal

Example

%%[
  SET @rows = LookupRows("zzprobecoupons__mo", "CouponCode__c", "PROBE0001")
]%%
%%=RowCount(@rows)=%%|%%=Field(Row(@rows, 1), "CouponCode__c")=%%

Renders 1|PROBE0001 for a test marketing object zzprobecoupons__mo that holds one record with the key PROBE0001. In Next, the first argument names a marketing object instead of a data extension.

Return value

rowset — every matching record, read with Row and Field. When nothing matches, the rowset has RowCount 0.

Behaviour

Tested in Marketing Cloud Next emails on 2026-11-25, one call per email, on the test marketing object zzprobecoupons__mo (key field CouponCode__c):

Filters on the key field. LookupRows("zzprobecoupons__mo", "CouponCode__c", "PROBE0001") returned one row, and Field read PROBE0001 from it.

Filters on other fields too. LookupRows("zzprobecoupons__mo", "IsClaimed__c", "false") returned the one unclaimed record (RowCount 1).

No match is not an error. LookupRows("zzprobecoupons__mo", "CouponCode__c", "NOPE0000") returned a rowset with RowCount 0.

The syntax is accepted at save. An email with LookupRows("ProbeDE", "K", "v") inside an IF 1 == 2 branch saved and published (2026-11-23).

Show Next test script
<!-- Marketing Cloud Next test script for LookupRows. Paste it into the HTML component of a
     Next email and open the preview. Each line prints the result Next gave when the call
     was rendered on its own (expect) next to the result of this run (got).
     Assembled from single-call test emails (dates on the page); it has not been
     run as one email. Calls that make Next fail are listed separately. -->
<p>c1 expect=[gated] got=[%%[IF 1 == 2 THEN SET @r = LookupRows("ProbeDE","K","v") ENDIF]%%gated]</p>
<p>c2 expect=[1|PROBE0001] got=[%%[ SET @lr1 = LookupRows("zzprobecoupons__mo","CouponCode__c","PROBE0001") ]%%%%=RowCount(@lr1)=%%|%%=Field(Row(@lr1,1),"CouponCode__c")=%%]</p>
<p>c3 expect=[0] got=[%%[ SET @lr2 = LookupRows("zzprobecoupons__mo","CouponCode__c","NOPE0000") ]%%%%=RowCount(@lr2)=%%]</p>
<p>c4 expect=[1] got=[%%[ SET @lr3 = LookupRows("zzprobecoupons__mo","IsClaimed__c","false") ]%%%%=RowCount(@lr3)=%%]</p>
<p>c5 expect=[1|seven] got=[%%[ SET @r = LookupRows("zzprobenumkey__mo","CouponNo__c","7") ]%%%%=RowCount(@r)=%%|%%=Field(Row(@r,1),"Label__c")=%%]</p>
<p>c6 expect=[1|seven] got=[%%[ SET @r = LookupRows("zzprobenumkey__mo","CouponNo__c",7) ]%%%%=RowCount(@r)=%%|%%=Field(Row(@r,1),"Label__c")=%%]</p>
<p>c7 expect=[1|70.0] got=[%%[ SET @r = LookupRows("zzprobenumkey__mo","Points__c","7") ]%%%%=RowCount(@r)=%%|%%=Field(Row(@r,1),"CouponNo__c")=%%]</p>
<p>c8 expect=[1] got=[%%[ SET @r = LookupRows("zzprobenumkey__mo","CouponNo__c","7","Points__c","70") ]%%%%=RowCount(@r)=%%]</p>
<p>c9 expect=[0] got=[%%[ SET @r = LookupRows("zzprobenumkey__mo","CouponNo__c","99") ]%%%%=RowCount(@r)=%%]</p>
<p>c10 expect=[1|9.0] got=[%%[ SET @r = LookupRows("zzprobenumkey__mo","CouponNo__c","8","CouponNo__c","9") ]%%%%=RowCount(@r)=%%|%%=Field(Row(@r,1),"CouponNo__c")=%%]</p>

Differs from official docs

  • Documented as unavailable in Next, yet it works. The availability table of the reference says No for Marketing Cloud Next. In a Next email the call read a marketing object: a key-field filter returned the matching row, a filter on another field worked too, and no match gave RowCount 0. A number key accepts the value as a string or a number. Two limits showed up on 2026-11-26: a filter that matched two records returned one row, and the same field in two pairs uses only the last pair. Card

Availability & differences

PlatformAvailable
Marketing Cloud EngagementYes
Marketing Cloud NextNot listed for Next in the official AMPscript reference. The language catalog lists it from API 68.0; it reads marketing objects in a Next email (tested 2026-11-25)
Same in Marketing Cloud Engagement

Both return every matching row as a rowset, and an empty rowset (RowCount 0) when nothing matches. In Next the call read a marketing object, filtered on its key field and on another field. Compared 2026-11-25 by rendering the same calls in a Marketing Cloud Next email.

See also