Pages

Monday, December 8, 2014

The "show once" messages in AX

There's a special kind of message that you can display to your users in AX, the "show once" messages. These are messages that the user may choose to not see again. That's because it has a "Don't show me again" flag.


This is specially useful for messages that you feel obligated to display, but that the user will most likely only be interested in on the first time he ever sees it.

Well, there's a special class called the BoxInfoOnce which does all of the work for us. It constructs the message form, and controls the user cache as to whether the user chose to not see given message again or not. With the simple code below, you can successfully display a message to the user that he can choose to hide in future executions:


    BoxInfoOnce     boxInfoOnce = new BoxInfoOnce();    
    
    boxInfoOnce.parmHeading("This is a heading");
    
    boxInfoOnce.parmInformation("This is the information");
    
    boxInfoOnce.prompt();


The code above produces the following form:


Since the user's choice is kept as cache, if he or she resets their usage data, their choice will be reset.