0

How can we determine the order in which the metadata is deployed?

I have developed a package which relies on EnhancedNotes and has a flow which creates EnhancedNotes. I have retrieved the metadata for enabling EnhancedNotes:

force-app/main/default/settings/EnhancedNotes.settings-meta.xml

<?xml version="1.0" encoding="UTF-8"?>
<EnhancedNotesSettings xmlns="http://soap.sforce.com/2006/04/metadata">
    <enableEnhancedNotes>true</enableEnhancedNotes>
    <enableTasksOnEnhancedNotes>true</enableTasksOnEnhancedNotes>
</EnhancedNotesSettings>

When I deploy my code to a scratch org, it fails with the error field integrity exception: unknown (The object "ContentNote" can't be created through a flow.).
But when I first deploy the folder containing the setting for enabling EnhancedNotes (force-app/main/default/settings) and then deploy the rest, it works fine.
So it seems there is a dependency issue (on EnhancedNotes).
While this two-step deployment works for development, when I want to create a package version, it has to be in one step, and gives the same error as above. It seems I need to instruct it in some way to first deploy the setting for enabling EnhancedNotes and then deploy the rest.

The issue is explained in this two-minute video. Thanks.

1 Answer 1

2

The settings folder is completely ignored when creating a package version. You need to tell the package which dependencies should be enabled in the project configuration.

First, enable the settings, as outlined in Scratch Org Features:

{
    "orgName": "My Org",
    "edition": "Developer",
    "settings": {
        "enhancedNotesSettings": {
            "enableEnhancedNotes": true
         }
         // Other settings, as needed
    }
}

Then, set up your sfdx-project.json configuration file to specify the configuration file:

{
  "packageDirectories": [
     { "path": "force-app",
       "default": true,
       "definitionFile": "./config/scratch-org.json",
       "versionName": "Latest and Greatest",
       "versionDescription": "Install it and find out!",
       "versionNumber": "1.2.3.NEXT"
     }
   ]
}
2
  • Thanks. When creating a package version, I assume only certain sections of the mentioned definition file are considered. For example "edition": "Developer" is not taken into account, right?
    – LoMaPh
    Commented Jan 25 at 2:05
  • @LoMaPh Correct, the orgName, edition, etc are used when creating a Scratch Org, while the settings will affect package versions.
    – sfdcfox
    Commented Jan 25 at 2:10

You must log in to answer this question.

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