Infolog in MSD axapta


The Infolog is used to communicate with the application users. You use the Infolog to inform the user of validations, if an error occurs, or to display information to the user while processing a job. The Infolog is opened in a separate window, and opens automatically when called by a program. Information in the Infolog is removed when the Infolog window is closed, so if you need the information for later use, you can print
the contents of the Infolog window by using the print menu item in the top menu.

Information in the Infolog can be triggered both from code and by the kernel. Kernel information typically involves system integrity issues, such as information about mandatory database fields. From X++ you can control the information in the Infolog.

There are three types of information in the Infolog. The types, which may be identified by the associated icon include: info , warning and error . Info text is generally displayed to inform the user about actions being performed by the system. Warnings and errors typically represent issues that may require action from the user, and may indicate that a process is unable to proceed. If a help page or an action is attached to the
information put in the Infolog, the icons will have a mark indicating the extra information.

 static void Intro_Infolog(Args _args)  
 int i;  
 info("This is an info.");  
 warning("This is a warning.");  
 error("This is an error.");  
 setprefix("prefix text");  
 for (i=1; i<=3; i++)  
 setprefix("1. for loop");  
 info("loop 1");  
 for (i=1; i<=3; i++)  
 setprefix("2. for loop");  
 info("loop 2");  
 info("Check customer parameters.", "",  
 identifierStr(Customer_defaultCust), ""));  
 info("Check the sales form help page.", "ApplDoc://Forms/SalesTable");  
 throw error("This error stop execution.", "");  
This is an example on how to use the Infolog from X++. The first three lines show how to add a simple info, warning and error information. When using warning() and error() information you will normally use the throw command as shown in the last line of the example, as the throw will stop any further action like updating a record.

If you are adding a lot of information to the Infolog, you can use the setprefix() function to organize the information and make the presentation more user friendly. The above example shows how you can structure a pair of nested loops so as to separately group the content in the Infolog. The prefix for the first Infolog entry represents the outer with separate indented prefixes created for each of the two loops that display info messages.

An entry in the Infolog takes three parameters. The last two parameters are options used for linking to a field in a form, or linking to a help page in the online help. The two last info() lines show how to use the optional parameters. The first links the Infolog entry to the customer parameter form. The system will display this form if the user double clicks on the message in the Infolog. The last info() entry links the Infolog entry to the sales
form’s help page. Notice the optional parameters are always used one at the time as you
cannot link to both a form and the help system. Using links in the Infolog is a userfriendly way of communicating with the user; when an error occurs. You can provide the user with information on where exactly to go to fix the problem or provide the user with additional help on how to resolve the error. Unfortunately, changes to these links do not propagate, so if a referenced form field name or help page is changed, you will have to manually maintain any associated links.

The Infolog has a size limit of 10,000 entries. The Infolog should not be used for reporting detailed status messages representing the normal activity of batch programs. You can programmatically change the infolog’s maximum size, but keep in mind that the Infolog is not meant to handle large amounts of data. Building an Infolog with several thousand entries takes time and processing resources