General X++ Development

How do I get the current record from a form datasource in X++?

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

How do I get the current record from a form datasource in X++?

SSunny Vasty75 reputation · answered Aug 13, 2026

Use the datasource cursor.

X++
CustTable custTable = CustTable_ds.cursor();

If you already have the datasource buffer available in the method, just use that buffer. Do not run another database select just to figure out which row the user is sitting on.