Syntax

Platform.Function.UpdateData(deName, updateField, updateValue, filterField, filterValue [, ...])
5+ arguments

Parameters

Name Type Required Description
deName string Yes Data Extension name or external key
updateField string Yes Column to update
updateValue string Yes New value for the column
filterField string Yes Column to filter on (identifies which rows to update)
filterValue string Yes Filter value

Additional updateField/updateValue pairs can be appended before the filter pair for updating multiple columns.

Examples

Update a single column

var affected = Platform.Function.UpdateData(
    "Subscribers",
    "Status",         "unsubscribed",   // column to update
    "SubscriberKey",  subscriberKey     // filter
);
Write(affected + " row(s) updated.");

Update multiple columns

Platform.Function.UpdateData(
    "Subscribers",
    "LastLogin",  Platform.Function.Now(),
    "LoginCount", loginCount + 1,
    "Status",     "active",
    "Email",      email   // filter: update rows where Email = email
);

Update with error handling

try {
    var updated = Platform.Function.UpdateData(
        "Orders",
        "ShippedDate", Platform.Function.Now(),
        "OrderID",     orderId
    );
    if (updated === 0) {
        Write("No order found with ID: " + orderId);
    }
} catch (e) {
    Write("Update failed: " + e.message);
}

Notes

  • If no rows match the filter, returns 0 (not an error)
  • UpdateDE is an alias for UpdateData
  • For insert-or-update logic, use UpsertData

See Also