1

hope you can help me.

I use sfdx force:data:tree:import to import data to my scratch org. I added a custom address field now on the account object and tried to import account records with an address (in the new custom field).

With the following tree file (which I exported right before with the tree export):

{
  "records": [
    {
      "attributes": {
        "type": "Account",
        "referenceId": "AccountRef2"
      },
      "Name": "Test Account 2",
      "Address__c": {
        "city": "Mainz",
        "country": "Germany",
        "countryCode": "DE",
        "geocodeAccuracy": null,
        "latitude": null,
        "longitude": null,
        "postalCode": "55116",
        "state": null,
        "stateCode": null,
        "street": "Test Straße"
      }
    }
  ]
}

I got the following error:

{
  "hasErrors": true,
  "results": [
    {
      "referenceId": "AccountRef2",
      "errors": [
        {
          "statusCode": "INVALID_FIELD_FOR_INSERT_UPDATE",
          "message": "Unable to create/update fields: Address__c. Please check the security settings of this field and verify that it is read/write for your profile or permission set.",
          "fields":["Address__c"]
        }
      ]
    }
  ]
}

I am a System Administrator, have read/write on the Address__c field and also the Modify All Data permission. So I should not anyhow be restricted to not be able to import the data with the address (without the address it is working totally fine).

Do you think the import is just not yet supported for the new custom address fields from salesforce or is there something I do wrong?

Looking forward for any help! Thanks.

1 Answer 1

1

I first tried to import the data through the direct field names (Address__City__s)

{
  "records": [
    {
      "attributes": {
        "type": "Account",
        "referenceId": "AccountRef2"
      },
      "Name": "Test Account 2",
      "Address__City__s": "Mainz",
      "Address__Street__s": "Test Straße",
      "Address__PostalCode__s": "55116",
      "Address__CountryCode__s": "DE",
      "Address__Country__s": "Germany"
    }
  ]
}

but there came a similar error like so:

We couldn't process your request because you don't have access to Address__Country__s on Account. To learn more about field-level security, visit Tips and Hints for Page Layouts and Field-Level Security in our Developer Documentation.

I didn't think about just removing the country field and exported a record with the address, to see how I need to format the address. The result is shown above in my question. But it did't work out to import it like this.

Now I just removed the Address__Country__s field and the import is working now with this tree file:

{
  "records": [
    {
      "attributes": {
        "type": "Account",
        "referenceId": "AccountRef2"
      },
      "Name": "Test Account 2",
      "Address__City__s": "Mainz",
      "Address__Street__s": "Test Straße",
      "Address__PostalCode__s": "55116",
      "Address__CountryCode__s": "DE"
    }
  ]
}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .