Runtime verified Test scripts included

Syntax

UpdateDE(dataExt, columnValuePairs, searchColumnName1, searchValue1[, searchColumnNameN, searchValueN, ...], columnToUpdate1, updatedValue1[, columnToUpdateN, updatedValueN, ...])  →  string

Parameters

Name Type Required Description
dataExt string Yes Name or external key of the data extension to update
columnValuePairs number Yes Count of search column/value pairs that follow
searchColumnName1 string Yes First column to match on
searchValue1 string | number Yes Value the first search column must equal
searchColumnNameN string No Further search columns, each paired with a value
searchValueN string | number No Value for the corresponding further search column
columnToUpdate1 string Yes First column to write
updatedValue1 string | number Yes New value for the first updated column
columnToUpdateN string No Further columns to write, each paired with a value
updatedValueN string | number No New value for the corresponding further column

Example

%%[
  UpdateDE("AMP_VERIFY_SCRATCH", 1, "Id", "D1", "FirstName", "Dorian", "Score", 33)
]%%

Renders nothing — UpdateDE returns an empty string. The 1 after the data extension is the search-pair count: one pair ("Id", "D1") selects the row, the rest are the new values. A later render reads back FirstName=[Dorian] Score=[33].

A realistic use flips a status field inside a send:

%%[
  UpdateDE("Subscribers", 1, "SubscriberKey", _subscriberkey, "LastSeen", Now())
]%%

Return value

string — always an empty string, so nothing is emitted. This is the only runtime difference from UpdateData, which returns the updated-row count. Use the *DE family inside email sends; use the *Data family on CloudPages.

Behaviour

The second argument is a count, not data. columnValuePairs states how many following pairs are search criteria; everything after them is update values — identical to UpdateData.

A no-match is a silent no-op — no error, no abort, nothing written.

Updates are not visible to same-render reads of a row already read. AMPscript caches data-extension row reads within a single render; confirm the update in a subsequent render.

Show test script
%%[
  VAR @b, @r
  SET @b = RequestParameter("b")

  IF @b == "zzz" THEN
    OutputLine(Concat("CTRL=[alive]"))
  ENDIF

  IF @b == "seed" THEN
    DeleteData("AMP_VERIFY_SCRATCH", "Id", "D1")
    InsertData("AMP_VERIFY_SCRATCH", "Id", "D1", "FirstName", "Dora", "Score", 3)
    OutputLine(Concat("seeded D1"))
  ENDIF

  IF @b == "upd" THEN
    SET @r = UpdateDE("AMP_VERIFY_SCRATCH", 1, "Id", "D1", "FirstName", "Dorian", "Score", 33)
    OutputLine(Concat("UpdateDE ret=[", @r, "]"))
  ENDIF

  IF @b == "read" THEN
    OutputLine(Concat("D1 FirstName=[", Lookup("AMP_VERIFY_SCRATCH", "FirstName", "Id", "D1"), "] Score=[", Lookup("AMP_VERIFY_SCRATCH", "Score", "Id", "D1"), "]"))
  ENDIF
]%%

Availability

Platform Available
Marketing Cloud Engagement Yes
Marketing Cloud Next No

See also