function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Vinicius ZVinicius Z 

Account teams in Salesforce DX Packages

Hello all,

I am having an issue when creating a Package Version with code that deals with AccountTeamMembers. It works fine in scratch orgs, but when running sfdx force:package:version:create, it gives me the following
BatchProcessCliente: Invalid type: AccountTeamMember

Offending code is as plain as 
AccountTeamMember newMember = new AccountTeamMember();

That is, package generation is completely ignoring the existance of Account Teams.

I have features and settings in my project-scratch-def.json like so
"features": ["ServiceCloud", "SalesCloud"],
    "settings": {
        "orgPreferenceSettings": {
            "s1DesktopEnabled": true,
            "chatterEnabled": true,
            "s1EncryptedStoragePref2": false,
            "translation": true
            "enableAccountTeams": true
        "opportunitySettings": {
            "enableOpportunityTeam": true
        "orderSettings": {
            "enableOrders": false

Is it documented anywhere that account team aren't supported in Second Generation Packaging? Am I missing something here?

Thanks in advance
Dan Beer 6Dan Beer 6
I'm sure you've already found the answer to this but thought I'd respond for anyone else looking for the answer.

You need to explicitly set the project scratch definition file in your sfdx-project.json:
      "path": "force-app",
      "default": true,
      "package": "my package name",
      "versionName": "ver 0.1",
      "versionNumber": "0.1.0.NEXT",
      "dependencies": [],
      "definitionFile": "config/project-scratch-def.json"
"A reference to an external .json file used to specify the features and org settings required for the metadata of your package, such as the scratch org definition."