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:
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 SalesforceAudit 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
- From Setup, enter 'User' in Quick Find box and select User Interface
- Select the checkbox to enable '"Set Audit Fields upon Record Creation" and "Update Records with Inactive Owners"'
- 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:
- Create a new permission set — Salesforce has a step-by-step tutorial here
- Under 'System Permissions,' grant either the "Set Audit Fields upon Record Creation" or "Update Records with Inactive Owners" permissions
- Save the new permission set
- Assign the permission set to the appriopriate users; here again, we can defer to Salesforce for a more detailed tutorial