In my last blog post, I went through the steps to using the Data Migration Framework. This post, I will explain the technical side of it.
To create a custom entity mapping, click on the Data migration framework > Create a custom entity for migration. Follow the wizard and enter your main table you want to import for.
Once the wizard is finished, it will generate an AOT project.

To explain the elements:
Query | The query is a definition of the target table. You could add additional table relationships in there if required for mapping. |
Table | The table suffixed with Entity is the stagging table to use for importing. |
EDT | The foreign key fields using RecId. The EDT generated is a string field representing the code (identification field). |
Class | The class is where we can put your business logic. For example, the EDTs with RecId need to be resolved. The below is a screenshot of a method that takes a string code and finds the related RecId (container is just a standard way of returning it).
 Then override the getReturnFields, adding your Generate method.

There other more complex uses for the entity class, other than resolving fields. Such as generating whole records like the Global Address book. |