I have recently had questions around how to import default site and warehouse locations for products when using AIF, so I thought an explanation and an example here might be helpful.
Three tables need to have the correct Dimension ID relationships setup in order for the item todefault the correct Site/Warehouse combination. Within AX, you can set these defaults by going to :Setup-Default Order Settings (Site specific)Setup-Site Specific Order Settings (Site and Warehouse)If you manually set those values, it adds the following records in each of thetables below:InventItemSalesSetupInventItemPurchaseSetupInventItemInventSetupBy adding values to the Default Order Settings, it creates a record with the
InventDimID Field=AllBlank2InventDimIDDefualt=’<site>’ (Dimension for the Site=1)By adding values to the Site Specific Order settings, it creates a secondrecord with the following values:InventDimID Field=’<location>’ (Dimension including the Warehouse)InventDimIDDefualt=’<site>'
For importing these records, you need to follow a similar pattern... The first record would have the following fields represented (all other fieldswould match current default values)InventDimID Field=AllBlank2InventDimIDDefault=’<site>’ (Dimension for the Site=1)The second record would have the following fields represented (all other fieldswould match current default values)InventDimID Field=’<site>’ (Dimension for the Site=1)InventDimIDDefault=’<location>’ (Dimension including the Warehouse)Here is a sample snippet (change the hard-coded values to match your data)…
arrpursetup = new AxdEntity_InventItemPurchSetup[2]; pursetup = new AxdEntity_InventItemPurchSetup() { ItemId = "CFL33" }; pursetup.InventDimPurchSetup = new AxdEntity_InventDimPurchSetup[] { new AxdEntity_InventDimPurchSetup() { InventDimId = "AllBlank2"}};
pursetup.DefaultInventDimPurchSetup = new AxdEntity_DefaultInventDimPurchSetup[] { new AxdEntity_DefaultInventDimPurchSetup() { InventSiteId = "1"} };
arrpursetup[0] = pursetup;
pursetup = new AxdEntity_InventItemPurchSetup() { ItemId = "CFL33" }; pursetup.InventDimPurchSetup = new AxdEntity_InventDimPurchSetup[] { new AxdEntity_InventDimPurchSetup() { InventSiteId = "1"}};
pursetup.DefaultInventDimPurchSetup = new AxdEntity_DefaultInventDimPurchSetup[] { new AxdEntity_DefaultInventDimPurchSetup() { InventLocationId = "11"} };
arrpursetup[1] = pursetup;
arrslssetup = new AxdEntity_InventItemSalesSetup[2]; slssetup = new AxdEntity_InventItemSalesSetup() { ItemId = "CFL33" }; slssetup.InventDimSalesSetup = new AxdEntity_InventDimSalesSetup[] { new AxdEntity_InventDimSalesSetup() { InventDimId = "AllBlank2"} }; slssetup.DefaultInventDimSalesSetup = new AxdEntity_DefaultInventDimSalesSetup[] { new AxdEntity_DefaultInventDimSalesSetup() { InventSiteId = "1"} }; arrslssetup[0] = slssetup;
slssetup = new AxdEntity_InventItemSalesSetup() { ItemId = "CFL33" }; slssetup.InventDimSalesSetup = new AxdEntity_InventDimSalesSetup[] { new AxdEntity_InventDimSalesSetup() { InventSiteId = "1"} }; slssetup.DefaultInventDimSalesSetup = new AxdEntity_DefaultInventDimSalesSetup[] { new AxdEntity_DefaultInventDimSalesSetup() { InventLocationId = "11"} }; arrslssetup[1] = slssetup;
arrinventsetup = new AxdEntity_InventItemInventSetup[2]; inventsetup = new AxdEntity_InventItemInventSetup() { ItemId = "CFL33" }; inventsetup.InventDimInventSetup = new AxdEntity_InventDimInventSetup[] { new AxdEntity_InventDimInventSetup() { InventDimId = "AllBlank2"} }; inventsetup.DefaultInventDimInventSetup = new AxdEntity_DefaultInventDimInventSetup[] { new AxdEntity_DefaultInventDimInventSetup() { InventSiteId = "1"} }; arrinventsetup[0] = inventsetup;
inventsetup = new AxdEntity_InventItemInventSetup() { ItemId = "CFL33" }; inventsetup.InventDimInventSetup = new AxdEntity_InventDimInventSetup[] { new AxdEntity_InventDimInventSetup() { InventSiteId = "1"} }; inventsetup.DefaultInventDimInventSetup = new AxdEntity_DefaultInventDimInventSetup[] { new AxdEntity_DefaultInventDimInventSetup() { InventLocationId = "11"} }; arrinventsetup[1] = inventsetup;
Laura, this is a great blog! I follwed your logic and was able to import successfully!!