Posts

Showing posts from May, 2013

Dynamics AX - Prompt Dialogs & Don't ask again restoration

Image
D ialogs like these are common.  Coding one in X++ is fairly straight forward. public void prompt() {      if (Box::yesNoOnce( "Title" , "Do you want to blah blah" , DialogButton::No, this .name()) == DialogButton::Yes)     {         info( "Do Stuff now" );     } } The trick here is the "Once" of the yesNoOnce method.  This tells AX to show a dialog with the checkmark, and if selected saves the user's choice... somewhere (voodoo magic).  This is all hooked together by the last parameter: str _owner (set to this.name() in the example).  This links the prompt to a key, which can be anything ("bob", "jaffa cake", etc..).  More info can be found in the documentation . The next time the dialog is code is called, the previous selection is honored.  So in the case of the code above, if the user had selected Yes and chose to not be prompted again, the code within the braces (line 5) still runs, even th