Monday, 19 March 2018

MDM Microsoft Dynamics AX 2012 R3


MDM Microsoft Dynamics AX 2012 R3

Here we are going to learn how to maintain and sync the Master data, if you have multiple environments.
For example, let’s say, your company have multiple dynamics AX 2012 environments running. And you want the customer/Vendors and items to be in sync and should be the same across the environments.
In this scenario, we can leverage the MDM features. MDM works with the help of Data import/export frame work DIXF.
What MDM does?
MDM utilize the SQL MDS to maintain the master database and if there is any change in the master database is sync to all the environments using hub and a spoke
A typical workflow between the hub and a spoke is as follows:
1. Changes are made in underlying tables that are encapsulated by an entity.
2. Change tracking in the AX 2012 database identifies the changes. These changes are then extracted by an MDM job into a Data Import/Export Framework staging table.
3. The changes are pushed out from the staging table to SQL MDS. There, the master data is updated with the new information if there are no conflicts. If there are conflicts, the conflicting records are set aside, and you are notified to manually resolve the conflicts.
4. MDM queries SQL MDS and retrieves any updated master data. MDM pulls this data back to the AX 2012 instance and loads it into staging tables.
5. A Data Import/Export Framework import job collects the data from the staging tables and performs inserts/updates to the appropriate target tables to bring them up to date.
MDM Architecture
As you can see in the below diagram, SQL Server MDS act as the central data store, and to track the changes made to data.

Then comes the AX 2012 DIXF, to export / import data between SQL MDS and AX 2012.
Next is the MDM, It is used to synchronize the data as per schedule and run the synchronization job.
How it works:
1. Install MDM
We can use Windows PowerShell command prompt to install MDM, type the following command, and then press ENTER:
Set-AXMasterDataManagementMDSSetup –MDSServerName -MDSDatabase
After MDM is installed you can see a new sub menu in DIXF as shown below.

2. Configure SQL MDS
In AX 2012, open Data import export framework.
    Ø  In Master data management, click Configure SQL Server Master Data Services connection.
    Ø  In the Master Data Services connection dialog box, enter the following information:
    Ø  In the Server field, enter the name of the server where SQL MDS is installed.
    Ø  In the Repository field, enter the name of the SQL MDS database.
    Ø  In the MDS service endpoint field, enter the URL for the SQL MDS web service, followed by /service/service.svc. For example, enter http://ContosoMDSServer/MDS/service/service.svc.
    Ø  Click Test configuration to test the connection. If you cannot connect, verify the availability of the SQL MDS server and your connection information.
3. Publish Entities to SQL MDS
To publish an MDM-enabled entity to SQL MDS, follow these steps.
    Ø  In AX 2012, open Data import export framework.
    Ø  In Master data management, click Publish entities to SQL Master Data Services.
    Ø  In the Publish entities to SQL Server Master Data Services dialog box, select the entities to publish to SQL MDS, and then click Create schema.
    Ø  After the schema has been created, open the SQL MDS web application, and verify that models for the selected entities appear in the Model field.
4. Configure Synchronization
To create a sync group, follow these steps.
    Ø  In AX 2012, open Data import export framework.
    Ø  In Master data management, click Manage Synchronization.
    Ø  In the Manage Synchronization form, click New to create a sync group.
    Ø  In the Create a New Synchronization Group form, enter a name and select a company for the sync group. The company uses your current company. When you have finished, click OK.
5. Add an Entity to a Sync Group
To add an entity to a sync group, follow these steps.
    Ø  In AX 2012, open Data import export framework.=
    Ø  In Master data management, click Manage Synchronization.
    Ø  Select the sync group to add an entity to, and then click Entities.
    Ø  In the Select entities form, follow one of these steps.
    Ø  If this entity is the first entity that you are adding to the sync group, select the entity in the Entity field. The Sequence value is automatically set to 1.
    Ø  If you have already added entities to the sync group, click New to add another row. Then, in the Entity field, select the entity. The Sequence value increments automatically.
    Ø  Repeat step 4 to add all the entities that you require to the sync group. Then click Close.

6. Set Up Synchronization for an Entity
To configure synchronization for an entity, follow these steps.
    Ø  In AX 2012, open Data import export framework.
    Ø  In Master data management, click Manage Synchronization.
    Ø  Select the sync group that contains the entity to synchronize, and then click Entities.
    Ø  Select the entity that you want, and then click Settings.
    Ø  In the Synchronization settings for the master data management entity form, set the following values for the entity:
    Ø  Synchronization type – If you have a multi-master environment, select Push and pull. If you have a single-master environment and this spoke is the single master, select Push and pull. If this spoke is a read-only spoke, select Pull only to pull data and disable push operations.
    Ø  Subscription view – Select the view that defines the master data to pull from SQL MDS for this entity. The default view is named DMFEntity_View and that contains all entity records. For more information about how to filter pulled data, see “Filter the Data That Is Pulled from SQL MDS,” later in this topic.
    Ø  Number of records – Set the number of records that are handled per thread. Typically, you leave this setting at the default value of 1. However, you can increase the value to increase throughput when you are processing lots of records. Use this setting together with the Number of tasks setting to manage throughput.
    Ø  Number of tasks – Set the number of records that are handled per thread. Typically, you leave this setting at the default value of 3, but you can increase the value to increase throughput when you are processing lots of records. Use this setting together with the Number of records setting to manage throughput.
    Ø  Query for export – Select the query that defines the data to push to SQL MDS for this entity. The default query is named DMFTargetEntity and that contains all entity records. For more information about how to filter pushed data, see “Filter the Data That Is Pushed to SQL MDS,” later in this topic.
    Ø  When you have finished setting the synchronization values, click Close.

7. Schedule a Sync Group
To schedule a sync group, follow these steps.
    Ø  In AX 2012, open Data import export framework.
    Ø  In Master data management, click Manage Synchronization.
    Ø  In the Manage Synchronization form, select a sync group, and then click New schedule.
    Ø  In the MDM synchronization form, click Recurrence, and then set the following values:
    Ø  The time zone – Your current time zone is used.
    Ø  The range of the recurrence – This value includes a start date and time, and an end date. For the end date, you can specify a date, select the number of times that the task runs before it expires, or indicate that the task has no end date and runs indefinitely.
    Ø  The recurrence pattern – This value includes the unit of time that is used and the frequency with which the task runs. Recurrence units range from minutes to years to allow for precise scheduling.
    Ø  For example, you want a task to start Wednesday, May 7, 2014, at 1:00 A.M. Pacific Standard Time, and you want the task to recur every Wednesday a total of 10 times. In this case, you specify the following values:
    Ø  In the Time zone field, select (GMT-08:00) Pacific Time (US & Canada).
    Ø  In the Starting time field, enter 01:00:00 am.
    Ø  In the Starting date field, enter 5/7/2014.
    Ø  Select End after, and then, in the Count field, enter 10.
    Ø  Select Weeks. Clear Monday, and select Wednesday. Leave the Fixed weekly interval value at 1.
    Ø  When you have finished creating the schedule, click OK.
    Ø  Typically, you run the task as part of a batch. Select Batch processing, and then, in the Batch group field, select a group.
    Ø  Click Alerts, and then select the alerts to receive. You can receive alerts when a batch job ends, is canceled, or raises an error. You can also select to receive other types of alerts as pop-ups. When you have finished, click OK.
    Ø  When you have finished configuring the sync group, click OK.

For More detail please visit:  https://technet.microsoft.com/en-us/library/dn720449.aspx

Thursday, 15 March 2018

The specified client configuration does not contain valid WCF error


When setting up client configuration, you may encounter the error "The specified client configuration does not contain valid wcf to resolve this error, follow below steps.

1)Open the .axc where this issue was being seen in the Microsoft Dynamics AX Configuration Utility.
2)Click on the 'Connection' tab
3)Click on the 'Refresh' button and wait for the process to complete.
4)Click on the 'Configure Services' button'
5)You will now see the info message. Click 'Ok'
Note 1 - Clicking 'Configure Services' will give this information. Click 'Ok'
6)You will now see the info message. Click 'Yes'
Note 2 - Clicking 'Ok' in Figure 2 gives this message. Click 'Yes'
7)You will now see the info message. Wait for the process to finish.
Note 3 - Clicking 'Yes' will show this process window.  Wait for it to finish
8)You will now see the info message. Click 'Ok'
Note 4 - Once the above process is complete, this information is presented. Click 'Ok'
9)A new window for Microsoft Service Configuration Editor will appear.  You can close this screen.
Note 5 - This pops up at the end of the process.  Just close out of it.
10)Save this configuration
11)Open the config file and verify there is an XML section of the file.

Tuesday, 13 March 2018

Delete AIF exception logs

Here we are going to learn, how to delete AIF exception logs that are created before some xxx date.

static void MK_ClearAIFLogs(Args _args)
{
    SysExceptionTable  aiflog;
    ;
    ttsbegin;
    delete_from aiflog where
    aiflog.createdDateTime <  datetobeginUtcDateTime(today()-30, DateTimeUtil::getUserPreferredTimeZone());
    ttscommit;
}

There are few points to be noted about the above code.
1. The AIF exceptions are stored in SysExceptionTable.
2. How to use date and time range in the select query
3. Set set based statement. (Speeding Up SQL Operations)


Import and Export file from BLOB storage Account(Azure) in D365 F&O using X++

  Import and Export file from BLOB storage Account in D365 F&O using X++ Import: /// <summary> /// MKInventQualityOrderLineService...