////Dynamic Field Data Transformation
Dynamic Field Data Transformation 2018-03-26T14:21:21+00:00

Dynamic Field Data Transformation

CopyStorm/Restore has the ability to transform data in the CopyStorm backup database prior to writing it to the target Salesforce. Built-in data transformers include:

  • Scramble — replace each letter with a different letter, replace each number with a different number.
  • Email Scrambler — build a new email address of the same size but with random letters & digits.
  • Asterisk — replace the source data with “******”.

If the built-in transformers are insufficient for your needs the instructions in this article can be used to add a new transformer to CopyStorm/Restore. The approach described in this article is the same as what CopyStorm/Restore does internally.

Step 1: Build a Java Class That Implements a Transformer

The first step is to build a Java class implementing “com.capstorm.copystormrestore.transform.ITransformer”. The code below contains the implementation of the Asterisk transformer:

public class AsteriskTransformer implements ITransformer {
    public String transform(String table, String column, int columnWidth, String recordId, String value) {
        if( StringUtils.isBlank(value)) { return value; }
            return StringUtils.repeat("*", value.length());

The parameters to the transform() method are:

Parameter Description
 table The name of the table containing the column to transform.
column The name of the column to transform.
columnWidth The maximum width of the column value.
recordId The Salesforce Id of the record being processed.
value The current value of the column. This may be null.

The method must return the value to insert / update in Salesforce.

Once the class has been created, package it into a jar and put the jar into the “lib” subdirectory of the CopyStorm/Restore installation. CopyStorm/Restore will only find your class if it is installed in this directory.

Step 2: Create an XML Configuration File

For CopyStorm/Restore to discover a field transform it must be declared in a file named “TransformerRegistry.xml” and placed into a directory where CopyStorm/Restore looks for configuration files (for example, the “config” sub-directory of the CopyStormRestore installation).

The TransformerRegistry.xml file should look like the following:

    <Transformer name="Asterisk" class="com.capstorm.copystormrestore.transform.AsteriskTransformer" />


  • “name” is the value that will appear in the CopyStorm/Restore GUI.
  • “class” is the full path to the class built in the first step.

Other Details

To set up a build and test environment for a new transformer in Eclipse:

  • Create a new Java project.
  • Update the new project’s path to reference all jar files in the “lib” sub-directory of CopyStorm/Restore.

For other development environments, including building and testing on the command line, make sure that all the required Jars are on your Java class path.

If this is to much for your team send an email to sales@capstorm.com and they will be happy to arrange a small service contract.


Product Questions: info@capstorm.com
Technical Support: support@capstorm.com
Phone: +1 314.403.2143