static void RecordSortedList(Args _args) { SalesLine localSalesLine,fetchSalesLine; RecordSortedList recordSorteList = new RecordSortedList(tablenum(SalesLine)); ; recordSorteList.sortOrder(fieldnum(SalesLine, InventTransId)); while select localSalesLine where localSalesLine.createdDateTime >= datetimeutil::addDays(datetimeutil::utcNow(),-10) { recordSorteList.ins(localSalesLine); } recordSorteList.first(fetchSalesLine); while(fetchSalesLine) { info (fetchSalesLine.SalesId); if (!recordSorteList.next(fetchSalesLine)) { break; } } }