dynamics ax 2012 form datasource sort X++

Today I got requirement to insert record at run time and shows result in sorted order. I used following code code snippets. Suppose we are sorting on Customer
in required field

CusTable_ds.query().dataSourceNo(1).sortClear();

CusTable_ds.query().dataSourceNo(1).addSortField(fieldNum(CustTable, AccountNum), SortOrder::Ascending);
CusTable_ds.executeQuery();

alirazazaidi

Ali Raza Zaidi, Microsoft ERP Consultant, Currently working for Business Experts Gulf in United Arab Emirates. Specialized in HR & Payroll, Supply Chain and Financials modules.