General X++ Development

How do I update multiple records using `update_recordset` in X++?

Asked by Sunny Vasty· Aug 13, 2026· 1 answers

How do I update multiple records using update_recordset in X++?

SSunny Vasty75 reputation · answered Aug 13, 2026

Use update_recordset when the update can be done as a set instead of row by row.

X++
SalesTable salesTable;

ttsBegin;

update_recordset salesTable
    setting YourCustomField = NoYes::Yes
    where salesTable.CustAccount == 'US-001';

ttsCommit;

For a simple bulk update, this is usually much better than looping through thousands of records and calling update() one at a time.

Just remember that set-based operations can fall back to row-by-row behavior depending on table logic, so do not assume every update_recordset is automatically one SQL statement.