Monday, November 13, 2017
AX 2012 R3 introduced quite a few new notable features to the system. One of particular interest is the Master Data Management (MDM) feature to AX 2012. This created the ability to synchronize data between several AX 2012 instances as well as several legal entities inside AX 2012 this providing yet another integration possibility.
Unfortunately, the Master Data Management was not widely used because it required a SQL server Enterprise license. As SQL server Enterprise edition licenses were marginally more expensive than the standard edition, limiting the use of Master Data Management in AX 2012.
Fortunately, licensing changes to the SQL server were introduced with the release of SQL Server 2016 R2; the Master Data Management no longer requires a SQL server Enterprise edition license. Post the SQL Server 2016 R2 release, we have noticed an increase in usage of Master Data Management in AX 2012 ERP systems.
Given this, we would like to share our experience gathered during several AX 2012 implementations with MDM. In this article, we will provide information on how to configure and adjust Master Data Management for your AX2012 implementation needs to make your MDM deployment for AX 2012 faster and less troublesome.
1. Installation and configuration
Initial installation and configuration of Master Data Management for Microsoft Dynamics AX 2012 is well documented by Microsoft. Below you can find links that contain detailed instructions on how to install and deploy Master data services.
After configuring Master Data Management, you then need to deploy it. Learn to deploy Master Data Management from this detailed Microsoft article:
2. Creating Master Data Management entities
After having successfully installed Master Data services, deploy one or more data entities. There are two possible ways to achieve that:
- Add an existing entity to Master Data Management; or
- Add a custom entity to Master Data Management.
Both approaches are well described in the following Microsoft TechNet article: https://technet.microsoft.com/en-us/library/dn720445.aspx
One of the most common mistakes when creating a new entity is to not enable ModifiedBy field on one or more tables. If this happens, the following error will be displayed:
Figure 1: Not enabled ModifiedBy error
To avoid this error, when creating new Master Data Management entity you should make sure that all tables specified in the change tracking query have a ModifiedBy property enabled.
3. Entity configuration
To configure your newly created Master Data Management entity for synchronization you must follow these steps:
1. Add your entity to target entities form.
a. Data import export framework - Setup - Target entities
2. Publish the entity.
a. Data import export framework - Master data management - Publish entities to SQL Master Data Services
b. Select your entity and press Create schema button.
3. Create a synchronization group and add your entity to it.
a. Data import export framework à Master data management à Manage synchronization
b. Create a new synchronization group by pressing button New, then select your entity.
For more detailed information please follow this Microsoft article on Master Data Management configuration:
4. Re-creating the entity
In some scenarios, you may need to re-create the existing entity. If the newly be created or modified entity is not up to date and the only way to refresh it is to re-create it. This section contains a list of steps that will achieve re-creation of the Master Data Entity:
1. Delete all the related Processing groups that use the entity you’re trying to re-create.
2. Delete your entity from Data import export framework - Setup - Target entities form.
3. Delete your entity from Master Data Services:
a. Open SQL Server 2016 Master Data Services home page using IE;
b. Click System Administration;
c. Find your entity and delete it.
4. Although you have deleted the entity from Master Data Services, Dynamics AX doesn’t recognize that it was removed, so you need to remove certain records from your Master Data Service database.
a. In your Master Data Service database find dbo.AxVersionTable and delete records related to the entity you’re trying to re-create.
After completing these steps, you can follow your regular Master Data Management entity configuration process: add entity in target entities form, publish entity and create a synchronization group.
5. Generate methods in entities
Generate methods are commonly created in Data Entity classes to support enhanced data import or export scenarios where exposing the field directly is not an applicable solution. This section will cover main aspects of how to correctly create generate methods.
In general, generate methods are used in cases when simple field mapping is not enough and you want to add some business logic behind the Master Data Management entity field. With generate methods, you can control what information you want inserted in Master Data Services and in target table. For example, you can create the target table field RefRecId, which refers to Product and in Master Data Services. You would show more meaningful DisplayProductNumber value. Here’s how the implementation of this generate method would look:
Figure 2: generate method example for DisplayProductNumber
Let’s dive a bit deeper into the generate method structure. Generate methods should be written in entity classes and their name should always start with prefix - generate. Generate method should have these four attributes:
a. Transformation indication attribute which should always have true as a parameter.
2. DMFTargetTransformationDescAttribute("<label id>")
a. Label or string describing generate method.
b. This attribute is optional.
3. DMFTargetTransformationSequenceAttribute(Transformation sequence number)
a. Sequence number tells when this generate method should be run.
b. To see the last sequence number go to Map staging to target form that can be opened by selecting your entity in Target entities form and pushing Modify target mapping button.
Figure 3: Staging to target mapping form
4. DMFTargetTransFieldListAttribute(<List of fields>)
a. A list of staging table fields used for data generation.
Generate method should always return a container with generated field values; although this container can be empty, meaning that no values will be returned.
Take DmfPriceDiscAdmTransEntityClass/generateDefaultAccountCode method as an example:
Figure 4: generate method for DefaultAccountCode
In this example, when moving data from staging to target table, the data is set through code without setting it directly using table mapping.
After generate method has been created you should also map this method to the target table fields using getReturnFields method. If this method does not yet exist, you must override it. Here’s an example of this method for an example that was described above:
Figure 5: getReturnFields method example
In cases where you don’t want to map the generate method to target table field, you should NOT append to con container.
How To: Troubleshooting Master Data Management Common Issues
To learn more about troubleshooting common issues with Master Data Management in AX 2012 stay tuned for our next blog…coming soon.