Search through blog..

Friday, October 12, 2012

Some Facts about Dynamics AX Infolog


·         Infolog is the basic communication to the Application user, simple example would be, We can use Infolog to inform the user about some validations in a form.

·         There are three types of information we can put to the user through Infolog, namely, info, warning and error.

Syntax:
info(“This is a info message”);
warning(“This is a warning message”);
error(“This is an error message”); 
·         Infolog can be triggered from both code and the kernel. Kernel information typically involves system integrated issues, such as information about Mandatory database fields.

·         We also have a setprefix() function to organize the information and make the presentation more user friendly.

Example (1):
setprefix(“List of some Even and Odd numbers”);
for (i=1; i<=10; i++)
{
setprefix("Even numbers");
if(i MOD 2 == 0)
info(int2str(i));
}
for (i=1; i<=10; i++)
{
setprefix("Odd numbers");
if(i MOD 2 != 0)
info(int2str(i));
}


Output:
      

·         Any entry in the Infolog takes three parameters. First parameter is Text “SysInfoLogStr” used to give description and is a Mandatory parameter.
The other two parameters are optional for linking to a field  in a form, or linking to a help page in the online help.

·         The below example illustrates the Second parameter (optional). It shows how to link the Infolog entry to the customer parameters form.
Example (2):
info("Check Customer Parameters.", "", SysInfoAction_FormRun::newFormName(formStr(CustParameters)));

Output:

By double clicking the text ‘Check Customer Parameters’ we can open the form ‘Accounts receivable parameters’

·         The below example illustrates the Third parameter (optional). It shows how to link the Infolog entry to sales form.

Example (3):
//To link to online site
info("Click online help: SysInfoAction",
http://www.axaptapedia.com/SysInfoAction_class);
//To link to Microsoft Dynamics help
info("Check the Sales form help page", "ApplDoc://Forms/SalesTable");

Output:
By double clicking the first message we can open the online link which is passed in the code. And by double clicking the second message we can open Microsoft Dynamics help for Sales table.

·          Note that the optional parameters are always used one at a time as you cannot link to both a form and the help system at the same time.

·         The Infolog has a size limit of 10000 enteries.

Tip:
If you get an error in the Infolog and want to trace the error using the debugger, you can set a breakpoint just before the error is inserted in the Infolog. Go to the class method Info.add() and set a breakpoint in the first code line.
Post a Comment