Data Migration is often a one-off process that takes place before go-live.

But changing custom field mappings,  re-creating custom objects or modifying record types and picklist values – these are just some of the ways to break a migration.

So, how do we initialize the environment so that automatic data migration processes are reliable and repeatable?

Best practice approach

To ensure auditability of the migration process, let’s:

  1. Create a dedicated Profile for the purposes of data migration
  2. Create a dedicated integration User, active for the one-off ingestion
  3. Use Apache Ant to automatically set the appropriate privileges on the profile.

Using the Apache Ant macro

First paste this macrodef into your build.xml

Then the macro may be called by any build target:

<target name="godmode">

How does it work?

The example script redeploys the Migration profile with the following:

  • Access to all visualforce pages and apex classes
  • Visibility on all custom applications and custom tabs
  • Field Level Security (FLS) editable on all standard and custom fields
  • Create Read Update Delete (CRUD) permissions on all standard and custom objects

Now rapid development can proceed in sandboxes and scratch environments, while the associated schema changes and mapping decisions will not impact scripted rehearsals.

Related Posts

Last modified: 4th August 2019