Syntax

Platform.Function.UpdateData(deName, whereFieldNames, whereFieldValues, fieldNames, fieldValues)
5 arguments

Parameters

Name Type Required Description
deName string Yes Data Extension name or external key
whereFieldNames string|string[] Yes Column name(s) to identify the rows to update; use an array for multiple columns (AND logic)
whereFieldValues string|array Yes Value(s) to match in whereFieldNames; must be an array of equal length when whereFieldNames is an array
fieldNames string[] Yes Array of column names to update
fieldValues array Yes Array of new values aligned to fieldNames

Examples

Update a single column

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

Update multiple columns

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

Update with error handling

try {
    var updated = Platform.Function.UpdateData(
        "Orders",
        ["OrderID"],     [orderId],   // filter
        ["ShippedDate"], [Now()]      // data to update
    );
    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