hljs.configure({cssSelector: "code"}); hljs.highlightAll();

Monday, October 11, 2021

X++ to code to capture infolog log messages in D365FO

  Public Str getErrorStr()

{

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

str retvalue ;

        while (sysInfologEnumerator.moveNext() )

        {

            switch (sysInfologEnumerator.currentException())

            {

                case Exception::Error:

                    retvalue = strFmt("%1", sysInfologEnumerator.currentMessage());

                    break;

            }

      }

Return retvalue ;

}