How to empty all string fields of the sObject?


I want to clear all textual fields of the Account by settings their value to null. The problem is, that I don't know what fields of the string type are there, so can't list hem in the query string.

Can I do that with the SFDMU ?


Yes, it's possible.

You can use the type_string Multiselect Keyword to select only fields of string type with the Data Anonymization feature to reset the these fields.

Run the job in the one-directional mode.

Below is the basic export.json configuration, which can help to achieve this challenge:


    "objects": [
            "operation": "Update",
            "externalId": "Id",
            "query": "SELECT type_string FROM Account",
            "mockFields": [
                    "name": "all",
                    "pattern": "c_set_value(null)",
                    "excludeNames": ["Name"] // This will exclude unwanted fields from being anonymizing
            "updateWithMockData": true

Run the job like that:

$ sfdx sfdmu:run -u

You omit the --sourceusername flag, because the Source and the Target are the same org (the one-directional mode is used).

Additional information:

Since multiselect keywords are often add to the query string a large amount of fields, It's recommended to exclude all object fields that you don't want to anonymize (like the Name field) using the excludeNames property (see the article about the Data Anonymization feature).

Last updated on 17th May 2023