3

I'm creating a scratch org definition file (project-scratch-def.json) in order to create an Unlocked Package that will interact with Salesforce Knowledge.

I'm currently stuck when I try to add a piece of code that is using the IsMasterLanguage field, because this field is only accessible if knowledge base supports multiple languages (docs).

Because of this, I tried to define my scratch org definition file to enable at least 2 languages, but it's not working out for me. Here's my definition file:

{
  "orgName": "knowledge_dev",
  "edition": "Enterprise",
  "country": "US",
  "language": "en_US",
  "features": ["Knowledge", "Communities"],
  "settings": {
    "communitiesSettings": {
      "enableNetworksEnabled": true
    },
    "knowledgeSettings": {
      "enableKnowledge": true,
      "enableLightningKnowledge": true,
      "defaultLanguage": "en_US",
      "languages": [
        {
          "active": true,
          "name": "en_US"
        },
        {
          "active": true,
          "name": "de"
        }
      ]
    }
  }
}

If I remove the languages part from the above definition file, I can create a scratch org, but it won't have multiple languages enabled. However, when I add the languages part (i.e. when I use the above defintition file as is), I'm receiving the following error when creating a scratch org:

Failed to deploy settings to scratch org.

So my question is how to enable multiple Knowledge base languages via scratch org definiton file?

1 Answer 1

3

Managed to figure out the correct JSON structure. language needs to be an array within languages field.

{
  "orgName": "knowledge_dev",
  "edition": "Enterprise",
  "country": "US",
  "language": "en_US",
  "features": ["Knowledge", "Communities"],
  "settings": {
    "communitiesSettings": {
      "enableNetworksEnabled": true
    },
    "knowledgeSettings": {
      "enableKnowledge": true,
      "enableLightningKnowledge": true,
      "defaultLanguage": "en_US",
      "languages": {
        "language": [
          {
            "active": true,
            "name": "en_US"
          },
          {
            "active": true,
            "name": "de"
          }
        ]
      }
    }
  }
}
1
  • I have the exact same issue. I tried the JSON you posted above, but it's not working for me. Getting the same error as you mentioned: "Failed to deploy settings to scratch org". Any ideas are appreciated.
    – San
    Mar 24, 2021 at 22:13

You must log in to answer this question.

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