MESSAGE function

MESSAGE is easy to use for the display of transient data and can be placed almost anywhere in our C/AL code. All it requires of the user is acknowledgement that the message has been read. The disadvantage of messages is that they are not displayed until either the object completes its run or pauses for some other external action. Plus, if we inadvertently create a situation that generates hundreds or thousands of messages, there is no graceful way to terminate their display once they begin displaying.

It's common to use MESSAGE as the elementary trace tool. We can program the display of messages to occur only under particular circumstances and use them to view either the flow of processing (by outputting simple identifying codes from different points in our logic) or to view the contents of particular data elements through multiple processing cycles.

To display information to the user without interupting them in their work, Notifications can be used. You can learn more about Notifications via this MSDN article: https://msdn.microsoft.com/en-us/dynamics-nav/notifications-developing.

MESSAGE has the following syntax: MESSAGE (String [, Value1] , ...]), where there are as many ValueX entries as there are %X substitution strings (up to 10).

Here is a sample debugging message:

MESSAGE('Loop %1, Item No. %2',LoopCounter,"Item No.");

The display would look as shown in the following screenshot (when the counter was 14 and the Item No. was BX0925):

When MESSAGE is used for debugging, make sure all messages are removed before releasing the object to production.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.163.250