Friday, January 6, 2023

Capture all Error logs trace in D365FO

    [SubscribesTo(classStr(Info), delegateStr(Info, onInfoLogMessageAdd))]

    public static void Info_onInfoLogMessageAdd(InfoLogMessageAddEventArgs _eventArgs)

    {

        SANPOCDebugTable    sanPOCDebugTable; (Enable with CreatedDateTime)

        boolean                      iscallStackUserEnabled;

            iscallStackUserEnabled = true;//Added custom checkbox on custom user setting

                   if(_eventArgs.exception == Exception::Info || 

                           _eventArgs.exception == Exception::Warning)

                    {

                        //If want to skip validation
                    }

                  else

                {

                sanPOCDebugTable.clear();

                sanPOCDebugTable.initValue();

                sanPOCDebugTable.RunByuserId = curuserid();

                sanPOCDebugTable.Exception = _eventArgs.exception;

                sanPOCDebugTable.InfologStr = _eventArgs.message;

                sanPOCDebugTable.CallStack = xSession::xppCallStack();

                sanPOCDebugTable.insert();

                }

}

//Create new form and add table on it -> Add button to import log information

//To Clean up -> Create batch run -> run to clean up data for past 90 days

//To add this new log form -> generic to all form UI. (To review logs)

Ref: Blog on Microsoft Dynamics AX/ D365: To add dynamics default controls on UI in D365FO (sangeethwiki.blogspot.com)

No comments:

Post a Comment

Copy Markup charges while posting purchase invoice using X++

 Copy Markup charges while posting purchase invoice using X++ Class: Important: Code logic is just for Reference.  New class => Duplicate...