MockField Object.


🡨 Go Back to Export.json File Overview

Table of Contents



MockField Object Overview

The MockField object within the SFDMU's export.json file is a child of the ScriptObject . It plays a vital role in the setup of data anonymization for specific Salesforce objects (sObjects) within a migration job.

This anonymization feature is activated by setting the updateWithMockData property to true on the parent ScriptObject. Configuring the mockFields array within this parent object allows for detailed specifications on how data should be anonymized during the migration process.

For further details, refer to the Data Anonymization feature documentation.

Configuring Data Anonymization

Below is an example of how to configure data anonymization using MockField objects within a ScriptObject:

{
  "objects": [
    {
      "query": "SELECT Id, Name FROM Account",
      "operation": "Insert",
      "externalId": "Name",
      "updateWithMockData": true,
      "mockFields": [
        {
          "name": "Name",
          "pattern": "name",
          "excludedRegex": "^DummyAccount$",
          "includedRegex": "Account\\sTo\\sMask"
        }
      ]
    }
  ]
}

MockField Object Properties

name (String)

Mandatory. Specifies the API name of the field to anonymize. The special value all can be used to indicate that all fields specified to update for the current object should be anonymized.

pattern (String)

Mandatory. This attribute specifies a predefined pattern used to generate mock data for a field. Below are resources where you can find various patterns:

excludedRegex (String)

Optional. A regex pattern that specifies values which should not be anonymized. This is useful when certain data entries need to be preserved in their original form.

includedRegex (String)

Optional. A regex pattern that specifies values which should exclusively be anonymized. This allows targeting specific data entries for anonymization.

excludeNames (Array of String)

Optional. Fields to exclude from anonymization, for example, when using the all keyword as name. This helps to selectively anonymize fields within an object while preserving specific field data.

Example of export.json Configuration:

{
  "objects": [
    {
      "query": "SELECT Id, Name, Phone, Email FROM Contact",
      "operation": "Insert",
      "externalId": "Email",
      "updateWithMockData": true,
      "mockFields": [
        {
          "name": "all",
          "excludeNames": ["Email", "Phone"] // Only Name will be anonymized
        }
      ]
    }
  ]
  // ... other export.json properties    
}
Last updated on 1st May 2024