How to handle checkbox fields during CSV imports in SFDMU?


Question:

When upserting Accounts from a CSV file, the process fails if the target organization has additional fields such as a Checkbox field (e.g., IsTest__c) that is not present in the CSV. The error "IsTest: value not of required type:" occurs because the checkbox values in the generated target/Account_insert_target.csv are empty (not boolean).

How can this issue be resolved?


Answer:

To resolve the issue with checkbox fields during imports using SFDMU, it is possible to insert an empty value instead of "false" for checkboxes, which effectively resets the checkbox in the target organization.

Here's a sample configuration for your export.json that specifically handles checkbox fields:

{
    "objects": [
        {
            "query": "SELECT Id, Name, TEST_CHK__c FROM Account WHERE Name = 'ACC_10000'",
            "operation": "Update",
            "externalId": "Name"
        }
    ]
}

In the corresponding Account.csv, ensure to represent the checkbox column without a value if you want to reset it:

Id,Name,TEST_CHK__c
0018d00000N237jAAB,ACC_10000,

If your checkbox field is set as required and does not accept null or "false" values, this configuration might not work as expected.

Verify whether the field settings in your Salesforce org allow for null values in checkbox fields.

Last updated on 20th Apr 2024