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

How to add the Display method in the form level in D365 F&O

 The below examle is to add the form -Data source level adding display method and assigning to form design control.