Monday, December 31, 2012

Happy New Year

Hi there!

I just wanted to take a few minutes and wish everybody in our community a happy new year filled with success, health and happiness.

For me, 2012 has been a great year. It has been full of new experiences that lead me to become a better person and also a much sharper professional. I'm grateful about all that I went through, and the people I met that helped me grow.

Next year is full of challenges for all of us, and hopefully, they will make us grow again and help us become better consultants and human beings.

Be safe and until next year :)


Friday, November 9, 2012

Why a resurgence in US manufacturing may be the next big bet?


Hi There,

I wanted to find the time this week to discuss and share my thoughts about the manufacturing sector here in the US. I think this is an important topic as it concerns our nation economic growth, but also it can have a positive/negative impact for many ERP consultants, and Microsoft Dynamics AX implementers.

I found an excellent study about this and after reading it, I do see the manufacturing trend being positive for the US as China no longer is the cheapest and most efficient place to do this. In addition, shipping, labor, and distribution costs are rising rapidly.

In addition, the U.S. has experienced the longest stretch of employment gains in manufacturing in almost two decades. Even though our economy is growing slowly … it is growing. There have been many “green shoots” in the economy from housing to autos to manufacturing. I beleive that the U.S. has had to learn how to transition from the post-bubble, post-recession economy in a strong, sustainable way.

Form the source:

"The manufacturing sector in the US is rebounding. Is this a cyclical recovery or could it be an indication of a more sustained one? PwC looks at possible structural changes in seven key areas that could lead to a sustained recovery and help reverse the offshoring of R&D and production in the manufacturing sector.

The key factors that could impact reshoring decisions include labor, materials, transportation/energy costs, market demand, the availability of talent and capital, tax rates, and currency fluctuations."
Until the next time.

Thursday, November 8, 2012

How to Add a Financial Dimension in AX 2012


Hi There!

I hope everybody is having a great week and that you are ready for the weekend. Well, things in New York are not that good. First we had Sandy and just yesterday (Wednesday) we had a Nor-Easter as well! I'm pretty sure the rest of the country has suffered from natural disasters, but I think New York wasn't prepared for something this big.

Anyway, life goes on and AX2012 does too. So, I wanted to share a great post about adding financial dimensions to AX 2012. The post goes in detail on this topic allowing us to deeply understand the relationship between financial dimensions and everything else in AX 2012, and it shows us a step-by-step sequence on creating new financial dimensions in AX 2012.

You can access the post here.

Have a great weekend!

Friday, October 5, 2012

Domain Driven Design - An Introduction.

Hi there,

I hope everyone is having a great week and that you are ready for the weekend. I this post I would like to explore a interesting programming concept and technique called Domain Driven Design and/or Domain-Centric programming.

Let me go in more detail into this concept. Data-centric generally means that we build a system around an understanding of the data you’ll be interacting with. The typical approach is to first model a database. The second step is to then take the model (the database) and make sure that resembles the domain (the business). The third step is to take a multi-tier approach to the model and the business where the UI, business Logic and database live in different layers.

At this point you might be thinking, well, Microsoft Dynamics AX is built like this, and the answer is yes. AX, in my opinion, uses a domain driven approach as it has been build for a large number of business models. In turn, the actual business domain (a business that just purchased AX) can be coupled to AX and vice-versa.

Domain-centric design focuses on the problem domain as a whole, which not only includes the data, but also the behavior. So we not only focus on the fact that an employee entity has a First Name, but also on the fact that the entity can get a vacation, or a raise.

The tool used is object oriented programming (OOP), which relies on the power of classes and encapsulation. The idea behind domain driven design is to build a system in a manner that’s reflective of the actual problem domain we are trying to solve. This is where business users come into play. For example, they’ll help you understand how the actual system currently works (even if it’s a manual paper process. and/or existing AX process) and how it ought to work. .

Anyone who’s gone through the above knows that learning a new business is the most complicated part of any programming job. For that reason, there are real benefits to making our code resemble, as much as possible, the domain.

Essentially what I’m talking about is communication. If your users are talking about Strategic Outcomes, which a month ago meant nothing to us, and our code talks about Strategic Outcomes then some of the ambiguity and much of the potential misinterpretation is cleaned up.

Ultimately, this is the true purpose of an enterprise developer – to understand the problem domain.


Doing domain driven design (DDD) design doesn’t necessarily mean we have to start with modeling the domain but rather it means that we should focus on the domain and let the business (domain in this case) drive our next steps. We may agree at this point that we should start with our data model (or existing data model such a AX).

DDD extends our organizational toolbox and borrows from well-known industry patterns. For example, In AX modules help us organize a larger single model into smaller chunks.
In most enterprise systems there are course-grained areas of responsibility. DDD calls this top level of organization a Bounded Context.
Let's take workers' compensation insurance policies as an example. These need to be concerned with elements such as:
  • Quoting and sales
  • General policy workflow (renewals, terminations)
  • Auditing payroll estimation
  • Quarterly self-estimates
  • Setting and managing rates
  • Issuing commissions to agencies and brokers
  • Billing customers
  • General accounting
  • Determining acceptable exposures (underwriting)

We could incorporate all of this into a single system, but in doing so leads us to many issues down the road. Business users might understand general workflow versus a policy in the context of payroll auditing in two very different ways. If we use the same policy class, we are pushing the limitations of that class and getting away from best practices such as the Single Responsibility Principle (SRP).

Systems that fail to isolate models often fall into an architectural style called The Big Ball of Mud. Also, DDD nudges you toward identifying contexts and constraining your modeling effort within particular contexts. We can use a simple diagram, called a context map, to explore the boundaries of our system.
Source: Microsoft

This is why when writing the code for our model, we need to understand the domain and resemble it (a representation of the model that is) in our code. For example, let’s assume for a minute that we are doing an implementation for a car dealership and that we've talked to our client and a few salespeople, and we’ve realized that a major point is keeping track of the inter-dependency between upgrade options.

Then, in code (and remember this is conceptual and does not have to be taken to AX and/or .NET) we’ll create four classes/objects to support the theory of "-dependency between upgrade options":

public class Car
private Model _model;
private List<Upgrade> _upgrades;
public void Add(Upgrade upgrade){ //todo }

public class Model
private int _id;
private int _year;
private string _name;

public ReadOnlyCollection<Upgrade> GetAvailableUpgrades()
return null;


public class Upgrade
private int _id;
private string _name;

public ReadOnlyCollection<Upgrade> RequiredUpgrades
get { return null; }


public class Car

private Model _model;
private List<Upgrade> _upgrades;

public void Add(Upgrade upgrade)

public ReadOnlyCollection<Upgrade> MissingUpgradeDependencies()

List<Upgrade> missingUpgrades = new List<Upgrade>();

foreach (Upgrade upgrade in _upgrades)

foreach (Upgrade dependentUpgrade in upgrade.RequiredUpgrades)

if (!_upgrades.Contains(dependentUpgrade)
&& !missingUpgrades.Contains(dependentUpgrade))





return missingUpgrades.AsReadOnly();



As you can see in the above code, we first implemented the Add method. Then we implement a method that allows us to retrieve all the missing upgrades for a specific car. The code should reflect all concepts exposed by the model. Classes and methods should be named according to the names defined by the domain.

Furthermore, associations, compositions, aggregations and sometimes even inheritances should be extracted from the model.  Sometimes, during implementation, we realise that some of the domain concepts discussed and added to the model don't actually fit well together and some changes are necessary. When it happens, we should discuss the problems and/or limitations with the domain experts and refactor the domain model in order to favour a more precise implementation, without ever distorting the business significance of the design.

Ultimately, the code is the most important artefact of a software project and it needs to work efficiently. Regardless of what many experts in the subject say, code implementation will have some impact on the design. However, we need to be careful and very selective about which aspects of the code can influence design changes. As a rule, try as much as we can to never let technical frameworks limitations influence our design, but as we know, every rule has exceptions.
Again, the code above is just conceptual for argument's sake, and it is a good exercise for now to highlight how we might get started and what that start might look like. The main idea behind the above code is that "simulates" the business need.

Becoming proficient with object-oriented programming is not an easy task. I believe is within the reach of most people, but it takes dedication, book learning, and practice. It also helps if you adopt an attitude of craftsmanship and continual learning.

Well folks, I hope you found this article interesting, and that it has helped you in any way to remind you of the basics of programming.

Until the next time.


Tuesday, September 25, 2012

Deploying AX 2012 Code : Spotlight


Hi There!
I hope everyone is having a good week. In this post I would like to do a spotlight of Dynamics AX Musings on deploying out code in AX 2012.
Joris brings to our attention the importance of focusing on models instead of XPO's when we want to move code to different instances of AX. In addition, he does a good job explaining the issues that we will experience when using XPO to migrate code instead of using models, and in what form code should really be handled in AX 201 when it comes to deployment.
Joris also points out ways to avoid downtime in a production environment by giving examples from his own experience and by doing an analysis of the white paper Deploying Customizations Across Microsoft Dynamics AX 2012 Environments.

From the post:

"I made this statement to one of our clients a few months ago, and I'd like to share it with you: moving XPOs is barbaric. Yes, barbaric. As AX developers, administrators, implementers and customers we need to move on.

Yes, moving XPOs has some benefits, but they are all benefits to circumvent proper procedure. The benefit of moving one piece of code? That's introducing risk and circumventing proper code release management (branching and merging for the version control aficionados).

The benefit of no downtime? That is bad practice, what about users that have cached versions of your code running in their sessions? Not to mention data dictionary changes. The benefit of not having to recompile the whole code base? Talk about bad practice again, and all the possible issues that come out of that. Sure, you say, but I am smart and I know what I can move without risk"
You can access this post from here.

That's all for now folks!


Wednesday, September 19, 2012

Microsoft Dynamics Events - Microsoft Dynanmics World

Hi there!

I got an email from Microsoft Dynamics World with a bunch of very interesting web casts. 

Topics vary from AP automation and Inventory management to Business Intelligence and CRM.

You can access this from here.

 That's all for now folks.

Friday, September 14, 2012

Delete User Layer with AX 2012 Management Shell


Hi there,

I hope you are ready for a great weekend. I will have to work, but this is why we love what we do, and believe that our customers should get the best of us.

Anyway, this is going to be a short post about how to delete a user layer from the model store in AX 2012. I have to say that I miss the flexibility of AX 2009 when it comes to application files and layers. The good news is that for the Microsoft Dynamics AX R2 release, we are supposed to have the code in a different database.

Ok, so going back to our topic, to delete a user layer from the model you first need to install the Management Tools from your AX 2012 setup. Once this is done, you can access the Microsoft Dynamics AX Management Shell and write the following script:

axutil delete /layer:Usr

See the picture below for more details:


As you can see, deleting a layer is not difficult at all and it happens fairly quick too. Also, it is very important that you have a backup of the database before performing this action.

That's all for now folks.

Tuesday, September 11, 2012

Unable to construct an object from the class in the batch framework -


Hi There!

I hope your week is going ok and with lots of challenges.

As we all know, when we want to run a custom class in the server as a batch job we need to extend the RunBaseBatch class and schedule a job for it.

Today I was working on a class that needed to be run in the server in AX 2012. However, before I scheduled the process, I made the choice to test my class from the client to make sure I did not have any bugs. When the test was successful, I scheduled the job and waited for the batch job status to go from Waiting to Ended, and to my surprise I got an error.

I wasn't sure if I did have another bug in my class that I did not catch, so I just copied the sample batch class Microsoft has here and schedule another job to see if the problem indeed in my code. I got the same error:

"Unable to construct an object from the class Sample Class in the batch framework. Make sure that the X++ code has been compiled to Microsoft .NET Framework CIL, and that the constructor does not require any parameters"

Looking at some documentation, I read that in some cases we need to generate a full CIL compile, but this takes forever. Then a good friend of mine mentioned that a an Incremental CIL will most likely fix the error, an it did.

So, just to be thorough I would like to show the steps on how to do this:

Open a new development environment and click Build and then choose Generate Incremental CIL.

It is going to take about 2-3 minutes (it depends from environment to environment).

Then, to double check if the job run well, go to System Administration > Inquiries > Batch Jobs and look for your job. It status should now be Ended.

That's all for now folks. Until the next time.


Monday, September 10, 2012

Creating a Retail Store in AX 2012 Retail


Hi there,

I hope everyone is ready for a new AX filled week, and that you had a good weekend. This week I have a lot of work ahead of me, but I wanted to take the time and share with you the steps necessary to create a retail store in AX 2012 Retail.

The creation of a retail store requires many steps and some planning. I would like to extend my gratitude to Liam Breslin for his knowledge on this topic. He is a Senior Consultant for Junction Solutions and he specializes in Retail. You can contact him on his LinkedIn profile for any questions you might have about AX 2012 Retail.

So, let’s go to the good stuff now and let’s create retail store in Microsoft Dynamics AX 2012

1- Go to Retail > Common > Organization

2- Click the Organization Hierarchy tab button to create a new organization hierarchy.

3- When the new window opens, click New and assign a name to the new organization hierarchy (i.e. Retail Store).


4- Then click the Assign Purpose button to open the Organization hierarchy purposes window. In here we need to link the Organization Hierarchy you just created in step 3 with the organizational chart portion of AX.  To accomplish this, click the Add button to add a new Assigned Category. Once you have created the assigned category, click the Set as Default button. This will set your configuration as the default one to carry on later on the process.


5- When step 4 has been completed, click the Retail Assortment menu on the left and follow the same process you executed in step 4.


6- When finished you should see the following

7- Then go to Organization Hierarchy and click the Organization Hierarchy view. When the Hierarchy Designer opens, click the Edit button.


8- Click the Insert button and choose Legal Entity

9- The legal Entity (i.e. CEU) will appear in the Retail Store designer.

10- Click as Save as Draft. On the Save Changes windows choose “Save as draft” and click OK.


11- Then you to Retail > Common > Retail Channels > Retail Stores


12- Click New Retail Store and fill the required fields.


13- Go to the miscellaneous fast tab and make sure you have your payment methods. On this, for some reason in my environment, the Credit Card Payment method needed to be setup to 2 and not 02.

14- If all goes OK, you should see the following.


15- Now, go back to Hierarchies to add your new Retail Store to it under your organization. For this, click the Edit button and choose “Keep working on this draft” and click OK.


16- Click the Insert button and choose Retail Channel.


17- From the Retail Channel window choose your new retail store, and click OK.

18- If all is ok, you should see something similar to the picture below.


19- Save your new model as draft again.


20- In order to make the model “official” within AX, we need to publish it. Do this by clicking Publish and Close the Viewer.


21- Select the effective date when you want this model to be active and click the Publish button.


22- You should see the following message.


Once you have created your retail store(s), then you can create assortments and assign them to products and/or product groups to be publish into the retail channels. The assortment(s) will then be transferred to the AXRetailPOS database through an N-JOB.

I will cover this portion in one of my next post.

Until then!


Thursday, September 6, 2012

Zip Codes Upload in AX 2012


Hi there,

Today I would like to discuss how to load Zip Codes to AX 2012 from a Text file and also point out what happens in the background.

In AX 2012, this task is fairly simple as there is an abstract class (AdressZipCodeImport) that takes care of this function. In addition to the abstract class, there is another class (AdressZipCodeImport_US) for each specific country that overwrites the ReadFile() method in the AddressZipCodeImport abstract class. In AX 2012, there only 4 countries available for Zip Code upload.

AddressZipCodeImport Class:


AddressZipCodeImport_US Class:

The AdressZipCodeImport_US class ReadFile() method contains a while loop that will allocate the data from the file being read  into the LogisticsAddress variables. To accomplish this, you will have to have your zip code, city, state and county name in an Excel file where you create the required spaces between fields and then save it as space delimiter file.

ReadFile() Method:

The following is an example of this sequence:


The following is the ReadFile() sub string coordinates:


When your file is ready, you can upload it by going to Organization Administration > Setup > Addresses > Import Zip/Postal codes:

Once you run this, the data will be in the LogisticsAddressZipCode table


It is very interesting to see how the AX 2012 team has put a lot of thought into these common tasks as they help us be more efficient on something we don't need to really spend a lot of time figuring out.

Until the next time!