Why data anonymization is not working ?


Question.

Not sure if I'm doing something wrong but this configuration is keeping the phone field value as the same as the source

{
  "objects": [
    {
      "operation": "Upsert",
      "externalId": "FirstName;LastName;Email",
      "mockFields": [
        {
          "name": "Phone",
          "pattern": "phone",
          "excludedRegex": "",
          "includedRegex": ""
        },
        {
          "name": "Fax",
          "pattern": "phone",
          "excludedRegex": "*",
          "includedRegex": ""
        }
      ],
      "master": false,
      "query": "SELECT Id, Name, updateable_true FROM Contact"
    }
  ]
}

It does not modfy phone on the Target.

Why ?


Answer.

  • Generally, your anonymization configuration is correct.

But you forgot to set updateWithMockData=true:

{
    "objects": [
        ...
    ],
    "master": false,
    "query": "SELECT Id, Name, updateable_true FROM Contact",   
    "updateWithMockData": true
}
  • We suggest do not set includeRegex or excludeRegex properties to empty value: "includedRegex": "", the better whould be to remove this.

So the final configuration:

{
  "objects": [
    {
      "operation": "Upsert",
      "externalId": "FirstName;LastName;Email",
      "mockFields": [
        {
          "name": "Phone",
          "pattern": "phone",
          "excludedRegex": "",
          "includedRegex": ""
        },
        {
          "name": "Fax",
          "pattern": "phone",
          "excludedRegex": "*"
        }
      ],
      "master": false,
      "query": "SELECT Id, Name, updateable_true FROM Contact",   
      "updateWithMockData": true
    }
  ]
}
Last updated on 17th May 2023