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.