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

Dialogs like these are common.  Coding one in X++ is fairly straight forward.







  1. public void prompt()
  2. {
  3.     if(Box::yesNoOnce("Title", "Do you want to blah blah", DialogButton::No, this.name()) == DialogButton::Yes)
  4.     {
  5.         info("Do Stuff now");
  6.     }
  7. }

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 though no prompt is shown.  If No, the code in the braces is skipped.  Pretty handy!

However, in my testing, I had selected Do Not Show Again, and found myself wanting to restore that dialog later.  Closing my client didn't work, and my patented Fist Shake™ had no success.  So after some searching, it became clear the setting had to have been saved somewhere in the Usage Data (File -> Tools -> Options -> Usage Data).



Simply resetting the user's Usage Data did the trick, but I wanted to find exactly where the setting lives.  So, after additional searching, I found it.  It lives in the Form Selections tab under system name "SysBoxForm".  Specifically and entry is created with the "More Info..." field set to the same value you passed into the _owner parameter in X++.  Deleting this entry allows the prompt to be displayed again.

Voodoo Mystery solved.



Comments

Popular posts from this blog

SQL Reporting Services - Viewer broken in Non-IE Browsers: FIX

Dynamics AX 2012 - Visual Studio Team Services Custom Work Item Fields Break Version Control (Error TF237121)

Dynamics AX SysFileDeployment Framework - Deploy files automatically (using resources) to the client on login