All posts by Erik Paulsson

DMF – DMF Service is unavailable

I got this message in the Beta 2 version of the Data Migration Framework in Dynamics AX 2012.

This link is an important piece of information that you will need to understand some of the errors you get while trying to set up some of the new functionality in BETA 2, such as ODBC connection as a source data format.

http://technet.microsoft.com/en-us/library/jj225595.aspx

I got this message when I was trying to validate the connection string to an ODBC database. The reason for this was that the original installation had failed because of some unknown reason.

DMF Service is unavailable

It´s important to know that we, in this case, have the installation of the server integration services on the same server as the AOS.

In Beta 1 the installation resulted in one new folder under program files, in Beta 2 there should be three folders.

1. Microsoft Dynamics AX 2012 Data Migration Framework Server Components(Beta)
2. Microsoft Dynamics AX 2012 Data Migration Framework Client Components(Beta)
3. Microsoft Dynamics AX 2012 Data Migration Framework Service (Beta)

In our case the Service folder and it´s content was missing. Knowing this, the error message I got started to make a lot more sense.

This is how you test if your service is up and running. Log in to your AOS server and open a browser, then enter this URL in your web browser:

http://DMF-Service-ComputerName:7000/DMFService/DMFServiceHelper.svc

Of course you have to change the “DMF-Service-ComputerName” part to your server name first.

When we tried this, the service was not up and running. What we did was to turn of the AOS service and then run the installation process again for the service part of the DMF installation. After it was finished our “Microsoft Dynamics AX 2012 Data Migration Framework Service (Beta)” folder was where is should have been all along, under Program files.

We then started the AOS service and tried again. This time we could both access the service using the URL in a browser and validate the connection string to the database on the odbc source data format.

On to the next challenge.

DMF – Error occured while doing bulkcopy from temp table to entity table

This is a generic error message you get in data migration framework from time to time.

Error occured while doing bulkcopy from temp table to entity table

I have found that the reason for this could one of many. This is the ones I have encountered.

Continue reading DMF – Error occured while doing bulkcopy from temp table to entity table

DMF – Cannot create a record in Product number (EcoResProductIdentifier)

When working with the new Data migration framework module in Dynamics AX 2012 you will encounter a lot of problems and strange errors. One I recently encountered is this error message.

“Cannot create a record in Product number (EcoResProductIdentifier). The record already exists”

Continue reading DMF – Cannot create a record in Product number (EcoResProductIdentifier)

Date and UtcDateTime interval for previous month

This code calculates the first and last date of the previous month.

1
2
3
4
5
6
7
8
9
10
11
12
static void EP_dateMonthInterval(Args _args)
{
    date            fromDate;
    date            toDate;
    date            baseDate = systemDateGet();
    ;
 
    toDate      = dateStartMth(baseDate) - 1;
    fromDate    = dateStartMth(toDate);
 
    info(strFmt("%1 - %2", fromDate, toDate));
}

UtcDateTime version of the same job.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
static void EP_UtcdateMonthInterval(Args _args)
{
    UtcDateTime     fromDate;
    UtcDateTime     toDate;
    UtcDateTime     baseDate = DateTimeUtil::utcNow();
    ;
 
    // Remove this month number of days.
    toDate = DateTimeUtil::addDays(
    baseDate, -(DateTimeUtil::day(baseDate) -1));
 
    // Add the rest of this days time minus one second.
    toDate = DateTimeUtil::addSeconds(
    toDate, -(DateTimeUtil::time(toDate)+1));
 
    // Remove the number of days we are on in
    // the previous month and add one second to 
    // get to the first of the month.
    fromDate = DateTimeUtil::addSeconds(
    DateTimeUtil::addDays(
    toDate, -(DateTimeUtil::day(toDate))), 1);
 
    info(strFmt("%1 - %2", fromDate, toDate));
}

Maps and MapEnumerators

This code put five records of the table CustTable in a map with the key AccountNum. Then the map is looped and the and AccountNum and customer Name is printed to the infolog.

The last part of the code finds the last AccountNum from from the loop directly from the Map, but after a check is done if the value is in the map. Performing a lookup for a value that doesn´t exist in map will result in a error.
Continue reading Maps and MapEnumerators

No valid document identified from the entity key

I recently encountered this problem while using the AIF framework in Dynamics AX 2009. I got it in the AIF Queue manager when one of my messages failed.
Since the message “No valid document identified from the entity key” doesn´t really give you a good clue of that the problem really is, I had to do some debugging. I found that the error occurred when the class AifConstraintListCollection did not contain any constraints and the message(document) was associated with a query.

Continue reading No valid document identified from the entity key

Create class and methods in x++

This job does three things.

1. Creates a new class, compiles and saves it.

2. Finds the class and adds a new static method to it.

3. Calls the new method using DictClass.

Continue reading Create class and methods in x++

Simple field lookup in form

This is a simple way to add a custom form lookup to a new field with x++ code. This example is done with a test table named FO_TestTable that has the three fields “TestField1”, “TestField2” and “TestField3”. The table FO_TestTable has an index named “TestIdx”.

I have added a field on the table CustTable named TestField1. On this field that now can be found on CustTable form on the CustTable datasource node, I have added the “Override method” “lookup”.

Below you can see how I have edited the method lookup to fit my needs. Notice that the sysTableLookup is based on an ordinary query, this means that you can manipulate this query as you see fit.

Continue reading Simple field lookup in form

Sorting containers with multiple levels

I encountered a scenario where I wanted to find a record of a certain type somewhere in a big container. This got med thinking, and the result is the code below. I wanted to be able to loop through a container no matter how big it was or how many levels of new containers it contained.

This job searches through the container con1 and sorts the types Integer, Real and String into separate containers. In itself this job might not be very useful, but my goal was to build something that could easily be modified to work in many different cases when looking for different values in containers.

It also finds the specific records of VendTable, CustTable and SalesTable that I hid inside the container structure.
Continue reading Sorting containers with multiple levels