26 April 2016

Pass the record from to class in ax 2012

LedgerJournalTable Form Button:

void clicked()
{
Args args = new Args();
VendInvoiceJournalLineImport invoicejournalimport
;
args.record(LedgerJournalTable);
invoicejournalimport = new VendInvoiceJournalLineImport();
invoicejournalimport.run(args);
LedgerJournalTrans_ds.executeQuery();
}

Class:

public void run(Args _args)
{
ledgerJournalTable = _args.record() as ledgerJournalTable;
dialog = new dialog('Excel Import');

dialogfield = dialog.addField(extendedTypeStr(FilenameOpen), 'File Name');
dialog.run();
if(dialog.run())
{
filename = (dialogfield.value());
application = SysExcelApplication::construct();
workbooks = application.workbooks();
if(filename)
{
try
{
workbooks.open(filename);
}
catch (Exception::Error)
{
throw error('File cannot be opened.');
}
this.dataImport();
}
}
}

1 comment:

  1. Very interesting to read, thanks for sharing that wonderful useful information, given programming coding was very excellent and easily observe all provided information.

    SEO Training in Chennai

    ReplyDelete

Give me the commetns and solutions

DB restore production DB to DEV environment in D365 FO using Bacpac file

  https://www.linkedin.com/pulse/restore-production-database-dev-environment-d365fo-using-abbas-tfwbe SQLPackage link : https://www.linkedin...