Posts

Dynamics AX - Enumerate subclasses of a specific class

A colleague of mine recently asked me if there was a quick way to find all of the classes that extend a certain base class. "But of course there is!" I said.  Here is the code block I sent him, should you, dear reader, need to accomplish a similar task. static void getSubclasses() {     List            subclassList;     ListEnumerator  listEnumerator;     SysDictClass    dictClass;     dictClass       = new SysDictClass(classNum(ExchangeRateProvider)); //Your class here     subclassList    = dictClass.extendedBy();     if (subclassList.elements())     {         listEnumerator = subclassList.getEnumerator();         setprefix(strfmt("%1 is extended by %2 subclasses", dictClass.name(), int2str(subclassList.elements())));         while (listEnumerator.moveNext()) ...

Dynamics AX - A-Job Actions not being generated for a Channel after restoring databases

A fter restoring the model and data databases in AX, the A-Jobs that were working on the environment I migrated from and were not working on the new environment. Specifically, actions were not being generated for the store I was using for the preaction of changing a released product's discount flag (retail fast-tab). Turns out, it's the distribution locations (Retail -> Setup -> Retail Scheduler -> Distribution Locations) that were cached in the Global Object Cache not matching.  Deleting and re-creating the distribution locations fixed the issue. I suspect also clearing the global object cache would have done the trick. See: http://msdn.microsoft.com/en-us/library/hh608239.aspx

Dynamics AX: Remove Empty Code Block Warnings

A X is very picky about having SOMETHING to do inside of a code block.  For example, the compiler will issue the warning "Empty compound statement." when compiling the following code: boolean bob; try {      //fancy code here } catch { } //warning here If you want to suppress this error, you can call Global::exceptionTextFallThrough() method.  This method does absolutely nothing (right click and go to definition to see for yourself), but it does satisfy the compiler enough to remove the warning. boolean bob; try {      //fancy code here } catch {      //This does nothing but suppress the warning       Global::exceptionTextFallThrough(); }

Dynamics AX - Retail Scheduler Gotcha

Image
O n a recent project, I ran into a bit of a "gotcha" today around data replication to the Retail POS in Dynamics Ax 2012 R2.  We had created our own schema in order to transfer customized table data to the POS, however, the data would never be written, no matter what we tried.  Before I get to the solution, fist some background on the new Retail Channel Schema in R2. In R2, Microsoft has moved away from a single schema mentality when synchronizing data to the POS.  It is now utilizing a more flexible multi-schema model.  One of the advantages of this model is to allow AX 2012 R2 to seamlessly communicate with both old and new POS versions without issue.  It does this by defining a schema for each version of the POS.  Out of the box, it looks something like this: Notice there are schemas defined for most version of Dynamics AX (this model doesn't support the POS pre-2009).  This will allow the Retail Scheduler to synchronize data between AX 201...

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 prompt...

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

Image
Download Source SSRS Browser Fix Installer A while back I was tasked with getting SQL Reporting Services reports rendering in MVC while deployed on the Cloud with Windows Azure, and the reports must render in IE, Firefox and Safari.  The scenario is somewhat similar to trying to ride a bicycle backwards while chewing bubble gum and reciting the last 18 pages of the 2nd volume of War and Peace... in Russian.  I was eventually able to complete the task, though it was not without much hair pulling and profanity.  That solution involved using local reports, an embedded Report Viewer control, and a custom state manager (I may blog about that later if there is any interest). Fast forward to my current project, and Lo And Behold there is a requirement for a cross browser reporting solution using SSRS (though thankfully this time sans Azure).  The difference here is we are able to use the SSRS Reporting Server's Report Viewer as opposed to embedding our own.  Ho...

MVC - Selectively Loading jQuery Debug or Release Scripts

Image
Download Project Source P age load times are critical to a satisfying user experience.  One of the simplest ways to reduce load times is to Minify your jQuery and Javascript files.  I won't go into detail on how to Minify those files in this post (hint:  http://yui.2clics.net/ ).  Instead, this article deals with the headaches of debugging Minified files. For example, here's a typical Javascript error: However, its impossible to debug this issue because I'm referencing the Minified version of jquery-1.5.1.  I'd have an easier time defusing a small nuclear device.  On the other hand, I don't want to go referencing debug versions of Javascript files throughout my code only to have to do a search and replace every time I want to release. The solution is in MVC's Html Helper classes. The @ Html and  @ HtmlHelper methods are provided to render html controls on the view in a code-centric way.  However, their functionality isn't ...