Importing credit card statements into Microsoft Dynamics AX 2012 using AIF and Transformation library

Microsoft Dynamics AX provides a way to import worker’s Credit card transactions out-of-the-box, however it works only if your credit card statement is already in XML format.

Most credit card companies (American Express, VISA) send statements to their clients in CSV format, so in order to leverage Dynamics AX credit card import functionality developers have to create additional transformation library and plug it into import sequence.

In this article we provide example of such transformation library in C# and step-by-step instructions on how to setup and execute credit card inbound AIF port with Microsoft Dynamics AX 2012, setup Credit cards for employees in Human Resource module and execute the import.

1) Extract attached Visual Studio project and sample files
2) Setup Inbound port and Transformation library in AIF
3) Setup workers credit card in Human Resources module
4) Run Credit card transactions import job using sample file attached

Extract attached Visual Studio project and sample files

The following files are included in file attached to this post.

• – Visual Studio C# project containing sample transformation library for 3 different file formats
• Amextest.csv – sample credit card statement
• Amextest.xml – sample XML output of transformation

Please note that these files are samples only and are provided “as-is.” You bear the risk of using them. You will need to modify them to match your credit card company's statement format.

Setup inbound port and Transformation library in AIF

1. Create new "AMEX" Inbound port

2. Select "Service Operation"

3. Select "Transform all requests" checkbox

4. Click "Inbound transforms button" to open Inbound transforms form

5. Click "Manage transforms" to open Manage transforms form:

6. Click "New" button

7. Click "Load" button, and provide path to transformation DLL generated from the sample project (AmexCsvTransformLibrary.dll)

8. Fill the rest of the data as shown below, and click "Close"

9. On Inbound Transforms form, Click "New" button  and select transformation created on the previous step

10. Close the form

11. Activate Inbound Port by clicking on "Activate" button


Setup workers credit card in Human Resources module

1. Open "Workers" form from Human Resources menu

2. Select a worker and click on "Expense/Credit cards" button

3. Enter credit card information for selected worker

Run Credit card transactions import job

1. Import credit card file by running "Travel and Expense\Periodic\Import a specific credit card file" job

2. Close the infolog

3. Now you can check the results in “Credit card transactions” form



Kirill Val

Comments (6)

  1. Daws says:


    I followed your blog and things worked like a piece of cake, however it didn't last long.

    When I tried to import the csv after couple of hours it kept throwing me an error saying:

    Multiple calls to CodeAccessPermission.Assert


    (S)ClassesAifNetworkSharevalidateInternal – line 78

    (S)ClassesAifNetworkSharevalidate – line 10

    (S)ClassesAifTransformAssemblySharegetFileFromShare – line 21

    (S)ClassesAifTransformAssemblySharegetServerAssemblyFromShare – line 22

    (S)ClassesAifTransformAssemblyShareloadTransformAssembly – line 46

    (S)ClassesAifTransformProcessorGetTransformInfoArray – line 56

    (S)ClassesAifTransformProcessorprocessFile – line 32

    (S)ClassesAifImportUtilProcessFile – line 41

    (S)ClassesSysImportProcessorprocessInput – line 24

    (C)ClassesSysImportBatchProcessorrun – line 35

    (C)ClassesSysImportBatchProcessormain – line 21

    I am not even able to delete any of the manage transforms.

    "Transforms cannot be deleted while dependent Transform pipeline elements exist. Delete dependent Transform pipeline elements and try again."  but there is no dependency or that transform is not being used anywhere else.

    Please help me,

    Thanks Daws

  2. Mike N Ike says:

    Yeah, it's not working for me.  I get an error "Error occurred while processing file inside transform pipeline:  Index was outside the bounds of the array."  Digging further, it seems that the AmountCurr field is ''.  I wrote a small .net app that consumes the dll that is produced by this article and it has a value for that field in the XML that is produced but, AX is choking on the XML.

  3. Daws says:

    The chances are dll is not updated on AX or it is still picking up the old dll.

    Have a look at this…/gg861992.aspx

    I had a similar problem then realized. manage transforms is still picking up my old dll and not the new one

  4. LAMV says:

    it doesn't import cardnumber  for me. I check TRVPBSMAINDATA table and it's blank value.

    I also wants to pass reference field which is credit card transaction description. when i set Reference, it says Reference is the invalid field and not part of the schema of TRVPBSMainDataService. how is it possible?

  5. sekhar says:

    Kindly let me know if any one has resolved that issue..Bcoz I am facing the same.

  6. Anuj Rastogi says:

    Hi Kirill_Val,

    Thanks for the blog. I couldn't find the dll named AmexCsvtransforLib.Dll in your attachment of files. How and where can I find it ? The Dll is given by third party/bank ?  

    1. Do I need to have the sample XML file output with me or can I generate from the standard AIF service?

    2. In case, we are getting some more fields in CSV file and for that we have added some of the fields in standard table. So now make the mapping and convert the code accordingly do I need to change the code in Dll ?

Skip to main content