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 AIF3) Setup workers credit card in Human Resources module4) 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