Sunday, April 25, 2010

Ax 2009: How to import customers and vendors in Microsoft Dynamics AX 2009

Cust, Vend import Microsoft Çözümü için tıklayın...


Bu biraz zor diyen arkadaşlar için, bu sevda bitmez diyenler için, hız görmek istiyorum diyenler için, MBS çözümünü benimsemeyenler için:) buyrun

1. In the Navigation Pane, click Administration>Periodic> Data export/import>Excel spreadsheets> Template Wizard.
2. In the Excel Template Wizard, follow the instructions to create a template for “VendTable”. For customers the CustTable should be selected in the table selection step in the wizard.
When creating the template select the option to create a definition group in AX for this template.
Also select the ‘Create supporting table worksheet’. This will create the lookup values for selection in the template worksheet .
3. Ensure that the number sequence is setup for the address book Id in parameter for Global address book. Navigate to Basic>Setup>Global Address Book>Parameters.
Click the Number sequences tab, and then verify that a number sequence is selected for the address book ID.
Note The number sequence that is selected cannot be set up as continuous.
4. Prepare the data in the file that you created in step 2 with the data that you want to import. Ensure that the all mandatory fields are populated in correct format and there are valid values in the lookup fields.
5. Leave the Address book ID field empty. The Address book ID field is populated when you import the Excel spreadsheet by using the number sequence that you set up in step 3. Pls ensure that the Address book type is set to “organisation” in the data template as shown below.
6. Navigate to Administration>Periodic>Data export/import>Definition groups.
7. Select the definition group that you created by using the Excel Template Wizard, and then click Table setup.
8. In the Table setup dialog box, click the Import Criteria tab, and then add the following code in the Import Criteria tab after the default line in the window.
What we are doing here is that we are bypassing the code of importing the data through the standard AX’s data import code but would call the “Insert” method to read the file and do the import.
In the default line ‘vendTable’ object was declared for the table ‘VendTable’. Therefore, ensure that the correct object name is used in the code as well.
To import vendors, add the following code in the table setup’s Import criteria code. For Custtable, please change vendtable words.
;
vendTable.insert();
return false;
9. Click the Compile
This step determines whether the code is typed correctly.
10. Click the Preview tab, verify that the fields match the correct values that are entered in the Excel spreadsheet. Close the Table setup dialog box.
11. In the Data export/import dialog box, select the definition group that you created, and then click Import.
12. In the Excel import dialog box, If the Excel spreadsheet is not at the same path which is in ‘Default file name” column in the definition group then browse and select the Excel spreadsheet, and then click OK.
13. Verify that your Vendor is imported into the VendTable (vendor master) and the visible in Vendor form and that a corresponding record is created in the DirPartyTable table.
Check the address tab if it is created for the vendor.
The Vendor Address Type is blank and the Name has “Primary Address”. Therefore, a little fix is needed after the data is imported in the vendor / customer. We would need to run the following jobs. Copy them in AOT as jobs
14. Job 1 – Update the Vendor Address Type
static void J1A_UpdateVendAddressType(Args _args)
{
VendTable vendTab; // Replace VendTable with CustTable when run this for customers.
DirPartyTable dirPartyTab;
Address addTab;
;
ttsbegin;
while select vendTab
join dirPartyTab
join forupdate addTab
where vendTab.PartyId == dirPartyTab.PartyId &&
addTab.AddrTableId == dirPartyTab.TableId &&
addTab.AddrRecId == dirPartyTab.RecId
{
if(addTab.Name == 'Birincil Adres')
{
addTab.type = AddressType::Payment;
// addTab.type = AddressType::Invoice;
addTab.update();
}
}
ttscommit;
}
14. Job 2 – To update the Address Type for vendors.
static void J2A_UpdateVendAddressName(Args _args)
{
VendTable vendTab; // Replace VendTable with CustTable when run this for customers.
DirPartyTable dirPartyTab;
Address addTab;
;
ttsbegin;
while select vendTab
join dirPartyTab
join forupdate addTab
where vendTab.PartyId == dirPartyTab.PartyId &&
addTab.AddrTableId == dirPartyTab.TableId &&
addTab.AddrRecId == dirPartyTab.RecId
{
if(addTab.Name == 'Birincil Adres' && addTab.type == AddressType::Payment)
{
addTab.Name = dirPartyTab.Name;
addTab.update();
}
}
ttscommit;
}

0 yorum:

Post a Comment