Sei sulla pagina 1di 6

Importing Customers/Vendors/Employees in Dynamics Ax 2009: In the Navigation Pane, click Administration Periodic Data export/import Excel spreadsheets Template

late Wizard. In the Excel Template Wizard, click Next. In the File name field, enter the name of the file that you want to use, and then click Next. On the Select tables page of the wizard, click CustTable/VendTable in the Available objects area, click the > button to insert the object into the Selected objects area, and then click Next. Now go to Basic Setup Global Address Book Parameters. On the parameters form click on the Number Sequence Tab, and check the Number sequence that is selected for the Address Book ID. Note: The selected Number Sequence cannot be selected to manual. Now get back to the exported Excel sheet, fill the data, but leave the Address Book ID field empty. It will be populated when importing the Excel sheet with the number sequence that was setup. Go to Administration Periodic Data export/Import Definition groups. In Data-export/import, select the definition group that was created using the Excel wizard, and then click on Table Setup.

In the Table setup dialog box, press on the Conversion Tab.

1- First type the following code, in case of Customers.


str dirId; ; // Check that the custtable table is not associated to Party. if (!custTable.PartyId || custTable.PartyId == "") { // Create a Party entry for the customer. dirId = DirParty::createPartyFromCommon(custTable).PartyId; custTable.PartyId = dirId; } else { DirParty::updatePartyFromCommonInsert(custTable.PartyId,custTable); }

And the following code in case of Vendors.


str dirId; ; // Check that the vendtable table is not associated to Party. if (!vendTable.PartyId || vendTable.PartyId == "") {

// Create a Party entry for the vendor. dirId = DirParty::createPartyFromCommon(vendTable).PartyId; vendTable.PartyId = dirId; } else { DirParty::updatePartyFromCommonInsert(vendTable.PartyId,vendTable); }

2- Select the Run Conversion check box. 3- Press the Compile button, in order to check that the code is typed correctly.

In the Application Object Tree (AOT), find the importData method in the following object: Classes\SysDataImportDefBase.

In the importData method, change the code as follows. Existing code


_curcommon.doInsert();
Replacement code

if (SysExpImpGroup::find(groupId).Type == SysExpImpType::Excel && _curCommon.TableId == tablenum(Address)) { _curcommon.Insert(); } else { _curcommon.doInsert(); }

NOW WE WILL USE THE FOLLOWING TABLES IN ORDER TO IMPORT THE ADDRESSES : TABLE 1 Back to Data export/import dialog box, select the definition group that you created, and then click Import.

This will simply create an Address Book ID for each Customer/Vendor, but wont import the address on the system. In order to import the addresses on the system, use the following procedure: In the Navigation Pane, go to AdministrationPeriodic Data export/import Excel spreadsheets Template Wizard Export the table named Address. In the Address excel sheet exported, fill the following values in the Table ID of the main table: 77, if you are importing Addresses for the CustTable. 505, if you are importing Addresses for the VendTable. 103, if you are importing Addresses for EmplTable.

In the Reference column, enter the Record ID, for the appropriate Customer/Vendor/Employee. In order to establish the link between each individual record, in the address table and its alternative record in the other Table.

Its very important that the records in the Reference column, should be of the type Text, otherwise after importing you would find that value Zero, is placed instead of the appropriate RecID. In case there were records with no addresses, it is preferred that you should place in them a Blank Address value just to prevent any future mistakes. Its preferred that the columns Address Type, and Street name should be the same, in order to prevent any future issues when saving the records. Finally Import the Excel Sheet into the System. After you finish the Import, open the AOT, and then browse for the Address table. Copy the Table into an Excel Sheet, and then find the RecID that was given to these records by automatically by the system.

Table 2 Now go back to AdministrationPeriodic Data export/import Excel spreadsheets Template Wizard Export the following table DirPartyAddressRelationship.

In the Address book ID, fill the column with the appropriate Address Book ID, whether it was for a Customer/Vendor/ Employee. Set the Primary Column to Yes, and the Status to Active. Import the Excel sheet into the System. After importing the sheet, open the AOT, and then browse the DirPartyAddressRelationship table. Copy all the records into an Excel file, and then find the RecId that was created by the system for that table. Table 3 Now go back again to AdministrationPeriodic Data export/import Excel spreadsheets Template Wizard Export the following table: DirPartyAddressRelationshipMapping.

This table is nothing but a Linkage, for the past few tables. You will find two columns named, Reference. In the First column, enter the RecIDs that were created by the system for the Address table. In the Second column, enter the RecIDs that were created by the system for the DirPartyAddressRelationship. In the Company column, enter the name of the company that you are importing the table for. Finally import the Excel sheet into the System. Take care as the two columns must be equal in number of records, and that the records must be in an appropriate arrange, in order not to cause any inconsistency between the addresses and the corresponding persons.

Potrebbero piacerti anche