logo

Safer Data Migration With Salesforce Audit Fields

In the last decade, companies have made a huge switch from legacy, on-premise servers to cloud-based applications. This shift has had lots of benefits — increased flexibility, lower costs to scale, etc. — but it’s also required a massive migration of data to the cloud. Salesforce, for example, has over 150,000 customers — many of which purchased the platform to replace an older, slower application that likely couldn’t keep up with their evolving business needs.

But data migration, if not done properly, can have downstream implications for accuracy. For example, importing data into a new system can change the way creation and modification dates are logged, which can lead to incorrect reporting, broken automation and other complications. Additionally, when compliance requirements come into question, these types of issues are put under a microscope and can end up costing you thousands of dollars in additional fees. 

Luckily, Salesforce is always three steps ahead — their Winter ‘16 release included the Audit Field function, which gives system administrators a foolproof way to ensure data migration doesn’t interfere with the accuracy of their data. Here’s how it works.

What are Audit Fields?

Audit fields in Salesforce capture the original creation and modification date of fields in your old system, so that they remain consistent when imported into Salesforce.  They allow you, when importing data into Salesforce, to define new values for the following fields:

  • CreatedByID
  • CreatedDate
  • LastModifiedbyID
  • LastModifiedDate

Without audit fields enabled, these fields would be read-only, and Salesforce would automatically populate them with the date they were imported into the system. Audit fields are available on a wide range of standard Objects, as well as all custom Objects. Additionally, for the Lead Object, audit fields are enabled on several other fields. You can find the full list here.

Salesforce recommends only enabling this feature while doing data migration — but if you’re routinely copying data from an external system into your Org, you can enable it permanently.  

How Do Audit Fields Work?

Audit fields are set through your Salesforce Settings and can be accessed through an API; in order to enable their use, you’ll first need to set up permissions.

You’ll also need to ensure that the user interacting with this data has the “Modify All Data” permission. Typically (if your access controls are configured properly) this is a user with the System Administrator profile, or equivalent. 

After this, you’re free to import your data as you normally would! When you match your fields in Salesforce to the columns in your imported file, you will simply map the field to the *now available* audit field in Salesforce. Salesforce will overwrite the “CreatedDate” with the old value in your imported file. All of your archived data can then be accessed through API. 

Creating Audit Fields

Creating audit fields essentially boils down to the above steps: setting up your specified fields to be enabled as ‘Audit Fields’ upon creation. You don’t have to do anything spectacular to make it happen, aside from mapping your fields to the columns in your .csv file. Instead, Salesforce does most of the work for you. 

A Step-by-Step Guide to Enabling “Create Audit Fields” Permissions in Salesforce

Audit field creation needs to be enabled both Org-wide and at the level of the individual user. To enable it Org-wide, follow these steps

  1. From Setup, enter ‘User’ in Quick Find box and select User Interface
  2. Select the checkbox to enable ‘”Set Audit Fields upon Record Creation” and “Update Records with Inactive Owners”‘
  3. Click Save

Then, users responsible for data migration will need to be granted these permissions, either by creating a custom profile or a permission set. We recommend using a permission set, which reduces the need for additional profiles, and can be applied to multiple users if necessary. To do this, follow these steps:

  1. Create a new permission set — Salesforce has a step-by-step tutorial here 
  2. Under ‘System Permissions,’ grant either the “Set Audit Fields upon Record Creation” or “Update Records with Inactive Owners” permissions
  3. Save the new permission set
  4. Assign the permission set to the appropriate users; here again, we can defer to Salesforce for a more detailed tutorial
As VP of Sales and Marketing, Paul is responsible for driving growth of of the Infrastructure and Applications products in the Netwrix portfolio. His main areas of focus are security and compliance for NetSuite, Salesforce and Network Infrastructure. He is passionate about Go To Market Strategies and driving positive outcomes for customers. Previously, Paul served as the VP of Sales and Marketing at Strongpoint where he ran Go To Market functions before it was acquired by Netwrix. Paul holds a Bachelor of Arts degree and a Masters in Business Administration from McMaster University in Hamilton, Ontario, Canada.