
- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 04-27-2022 12:50 PM
Import sets are a wonderful tool for importing data from various sources, but one tiny mistake in the data or the transform map can lead to an entire data set being corrupted. With no straightforward way to revert the changes, we need to resort to fix scripts or manual activities to remove or rollback the changes. This can consume plenty of time and it can get increasingly frustrating with large import sets or complex transforms that insert or update multiple targets per row.
We know that when you are changing data through a background script, rollback contexts are created, and you can rollback all the changes. So why do not import sets have the same option? Well, they do now, sort of 😃
The functionality I propose is a proof of concept that intends to fill this gap and offer an easy way to rollback any changes done while transforming an import set.
In order to achieve this, three steps are required:
- Save the initial state of the target record
- Save the final state of the target record
- Revert from the final state to the initial state of the target record
Since the states of the record must be saved and available at any time we need to rely on a custom table, similar to the version table, that will store the initial and final state of the record.
The only time we can save the states is during the transform of the import set, more specifically in the transform map. Based on the transform scripts execution order we can use the onBefore script to save the initial state and the on Complete script to save the final state.
For the last point, the reversal is just a matter of removing or updating the target records to the initial state and can be triggered by the user when needed.
This is a broad description of the solution, but you can find a first version of the implementation with all the necessary information here. The implementation details and how to use it can be found in the project details and I invite you to try it. The project is a proof of concept and there is still room for improvement, but I do hope this will save someone a lot of time and headaches.
- 5,071 Views
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Compared to your solution, what would You think about this one (using a tag) ? : https://codecreative.io/blog/prepare-your-import-sets-for-rollback/