21 October 2020

X++ code to get datasource using control event handler in D365FO

FormRun formRun = sender.formRun();

        Object          inventTrans_ds = formRun.dataSource(formDataSourceStr(InventMarking,InventTransOrigin));

{


 FormRun formRun = sender.formRun();

        Object          inventTrans_ds = formRun.dataSource(formDataSourceStr(InventMarking,InventTransOrigin));


InventTransOrigin localInventTrans;

        InventTrans localInventTrans_1;

        for (localInventTrans = inventTrans_ds.getFirst() ? inventTrans_ds.getFirst() : inventTrans_ds.cursor();

        localInventTrans;

        localInventTrans = inventTrans_ds.getNext())

        {

            localInventTrans_1 = InventTrans::findByInventTransOrigin(localInventTrans.RecId);

        }

}

Ledger Voucher creation Framework and x++ code to create ledger voucher

 Please click her for MS reference file Below is the out of the box example reference and code. SalesInvoiceJournalPostSubBill_Extension->...