In Microsoft Dynamics AX (X++), there are many scenarios where you need to duplicate data from one table to another—especially during custom import, duplication, or versioning processes. Traditionally, this is done by manually assigning each field: targetTable.Field1 = sourceTable.Field1; targetTable.Field2 = sourceTable.Field2; ... But what if the tables have many fields ? Or maybe you’re dealing with multiple similar table pairs? That’s where the powerful DictTable class comes in. Let’s walk through how to use it to copy matching fields dynamically between two tables. 💡 Use Case: Copy Customer Templates Let’s assume you have these tables: CustTemplateHeader – stores predefined customer templates. CustTemplateHeaderHistory – a historical copy of templates for versioning. You want to copy records from CustTemplateHeader to CustTemplateHeaderHistory , but only for fields that exist in both tables. ✅ The Solution Using DictTable SalesHeaderTemplate ...
/** * Calculate the managed cost for a given item and site. * * @param _itemId The ItemId for which the managed cost is to be calculated. * @param _siteId The SiteId for which the managed cost is to be filtered. * * @return The calculated managed cost for the given site. */ private real calculateManagedCostBySite(ItemId _itemId, InventSiteId _siteId) { Query query; QueryRun queryRun; QueryBuildDataSource inventSumDS, inventDimDS, inventTableDS; InventSum ...