General X++ Development

How do I find a record by RecId in X++?

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

How do I find a record by RecId in X++?

SSunny Vasty75 reputation · answered Aug 13, 2026

You can select by RecId directly.

X++
MyTable myTable;

select firstOnly myTable
    where myTable.RecId == _recId;

If the table already has a standard findRecId() or similar find method, I normally use that instead. It keeps the lookup logic in one place.