[D365] Get DataSource object from FormDataSourceEventHandler

Just a short snippet to show you how to get the DataSource object from a FormDataSourceEventHandler in D365fO because I search it in my Evernote most of the time:

[FormDataSourceEventHandler(formDataSourceStr(LedgerJournalTable, LedgerJournalTable), FormDataSourceEventType::Activated)]
public static void LedgerJournalTable_OnActivated(FormDataSource sender, FormDataSourceEventArgs e)
        LedgerJournalTable currentRecord = sender.cursor();
        FormDataSource ledgerJournalTableDS = sender.formRun().dataSource(formDataSourceStr(LedgerJournalTransDaily, LedgerJournalTrans));

        // ...



Software Engineer / Application Developer

Subscribe to robsCode

Get the latest posts delivered right to your inbox.

or subscribe via RSS with Feedly!