web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Updating Created on/ M...
Power Apps
Suggested Answer

Updating Created on/ Modified on data

(1) ShareShare
ReportReport
Posted on by
I have migrated data from one environment to another in Dataverse. However, I need to update the 'Created On' and 'Modified On' fields with the original data. Is there an option to do this? Any help would be appreciated.
I have the same question (0)
  • wolenberg_ Profile Picture
    1,033 Moderator on at
    Hello There,
     
    In Dataverse, the Created On and Modified On fields are system-managed, so you can’t update them directly after records are migrated. They’re automatically set when a record is created or changed.

    If you need to preserve the original timestamps, here are the usual approaches:
    • Configuration Migration Tool  when moving data, this tool can bring over system fields like Created On and Modified On so they keep their original values.
    • Dataflows/ETL tools  some import methods allow mapping system fields during migration if you enable that option.
    • Custom fields workaround if the migration is already done, you can add custom fields (e.g. OriginalCreatedOn, OriginalModifiedOn) and store the old values there for reference.
     

    So in short: you can’t edit those fields directly in Canvas Apps or Dataverse after the fact, but you can preserve them during migration with the right tools, or store them separately if you’ve already moved the data.
  • Suggested answer
    iampranjal Profile Picture
    6 on at

    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!

  • Suggested answer
    iampranjal Profile Picture
    6 on at
    You can find the code here for the Pre-Operation Plugin

    public void Execute(IServiceProvider serviceProvider)
    {
        // ... standard context setup ...
        if (context.InputParameters.Contains("Target") && context.InputParameters["Target"] is Entity target)
        {
            // Check if the temporary 'Created On' field holds a value
            if (target.Contains("new_preservecreatedon") && target["new_preservecreatedon"] != null)
            {
                // Overwrite the system Created On field
                target["createdon"] = target["new_preservecreatedon"];
                
                // Cleanup: Remove the temp field from the target so it doesn't get saved (optional)
                target.Attributes.Remove("new_preservecreatedon"); 
            }
            // Check if the temporary 'Modified On' field holds a value
            if (target.Contains("new_preservemodifiedon") && target["new_preservemodifiedon"] != null)
            {
                // Overwrite the system Modified On field
                target["modifiedon"] = target["new_preservemodifiedon"];
                
                // Cleanup
                target.Attributes.Remove("new_preservemodifiedon");
            }
        }
    }

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard