Partilhar via


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 CreditCardCodeSample.zip file attached to this post.

• AmexCsvTrasformLibrary.zip – 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

 

 Cheers,

Kirill Val

CreditCardCodeSample.zip

Comments

  • Anonymous
    March 11, 2014
    The comment has been removed

  • Anonymous
    May 22, 2014
    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.

  • Anonymous
    June 12, 2014
    The chances are dll is not updated on AX or it is still picking up the old dll.Have a look at thistechnet.microsoft.com/.../gg861992.aspxI had a similar problem then realized. manage transforms is still picking up my old dll and not the new one

  • Anonymous
    May 11, 2015
    The comment has been removed

  • Anonymous
    July 12, 2015
    Kindly let me know if any one has resolved that issue..Bcoz I am facing the same.

  • Anonymous
    November 10, 2015
    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 ?