27 February 2021

Capturing infolog error messages in AX 2012 X++ code to capture the error infolog

InfologData             infoLogData;

SysInfologEnumerator    sysInfologEnumerator;

 sysInfologEnumerator = SysInfologEnumerator::newData(infolog.infologData());

 while (sysInfologEnumerator.moveNext() )

 {

        switch (sysInfologEnumerator.currentException())

        {         

            case Exception::Warning:

                 info(strFmt("Message is %1", sysInfologEnumerator.currentMessage()));

            break;

        }

}

=============

 catch (Exception::CLRError)

                {

                    ex = ClrInterop::getLastException();

                    if (ex != null)

                    {

                        ex = ex.get_InnerException();

                        if (ex != null)

                        {

                            error(ex.ToString());

                        }

                    }

                }

25 February 2021

D365FO COC methods and usage

How to get Form data source field method COC current record:

FormDataObject dataObject = any2Object(this) as FormDataObject;

FormDataSource dataSource = dataObject.DataSource();

CustGroup custGroup = dataSource.cursor();


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->...