Hi there,
Yes, you can update the Created On and Modified On fields for existing records, but since these are system fields, standard workflows or Power Automate won't work directly. You will need to write a simple plugin to handle this.
Here is a step-by-step approach to achieve this:
Step 1: Create Temporary "Carrier" Fields
First, create two temporary Date Time columns in your table (e.g., new_PreserveCreatedOn and new_PreserveModifiedOn). These will act as carriers for your original data.
Step 2: Write a Pre-Operation Plugin
You need a plugin registered on the Update message of your entity.
-
Stage: Pre-Operation
-
Mode: Synchronous
The Logic:
In the plugin, check if your temporary fields contain data. If they do, map those values to the system createdon and modifiedon fields. Finally, remove the temporary fields from the Target (or set them to null) so you don't actually store the temporary data unnecessarily.
Here is a sample of what the code would look like:
Step 3: Trigger the Update
Once the plugin is registered, you just need to update your records. You can write a small Console App or standard script to update the new_PreserveCreatedOn and new_PreserveModifiedOn fields with your original migration dates.
As soon as you update these fields, the plugin will fire and force the system Created On and Modified On dates to match your original data.
After updating the values you delete those new new_PreserveCreatedOn and new_PreserveModifiedOnfields from the table
Hope this helps!