Get selected record from SalesTableListPage x++?

When i tried to get the select rows from the grid, just get the last selected 

class SalesTableListPage_Form_ReleaseToWarehouseSecHandler
{
    [FormControlEventHandler(formControlStr(SalesTableListPage, ReleaseToWarehouse), FormControlEventType::Clicked)]
    public static void ReleaseToWarehouse_OnClicked(FormControl sender, FormControlEventArgs e)
    {
        FormRun form = sender.formRun(); 

        FormDataSource SalesTable_ds = form.dataSource() as FormDataSource;//(formDataSourceStr(SalesTableListPage, SalesTable)) as FormDataSource;
        SalesTable salesTable ;

        for(salesTable = SalesTable_ds.getfirst(true) ? SalesTable_ds.getfirst(true) : SalesTable_ds.cursor();
        salesTable;salesTable = SalesTable_ds.getnext())
        {

        }
    }

}

OR

[FormControlEventHandler(formControlStr(InventTransferOrders, ButtonInventTransferShip), FormControlEventType::Clicked)]
    public static void ButtonInventTransferShip_OnClicked(FormControl sender, FormControlEventArgs e)
    {
        FormRun element =               sender.formRun();
        FormDataSource SalesTable_DS =   element.dataSource(formDataSourceStr(InventTransferOrders, inventTransferTable));
        MultiSelectionHelper            selectionHelper = MultiSelectionHelper::construct();//Create instance of class
        Set                             selectedRecords = new Set(Types::Record);//Declare a set of type record
        
        inventTransferTable inventTransferTable;
        inventTransferTable =sender.formRun().dataSource(1).cursor();
        selectionHelper.parmDataSource(SalesTable_DS); //Set the datasource
        inventTransferTable  = selectionHelper.getFirst(); //assign to table buffer the reference to selected record(s)
        
        if (inventTransferTable.RecId)
        {
            while (inventTransferTable)
            {
                info(inventTransferTable.TransferId);
                inventTransferTable = selectionHelper.getNext();
            }
        }

    }

This code worked fine with other forms but salesorderlistpage just get one record

Thank you in advance.

Parents
No Data
Reply Children
Related
Recommended