Loading

INTERNAL: Unlocked Package - While creating Package version should include definition file with command

Publiceringsdatum: Jun 17, 2026
Beskrivning
While creating package version we validate the package metadata, we validate the dependencies and these dependencies can be metadata related (dependency on metadata in other dependent packages) OR feature related (E.g.: package metadata requires multi-currency etc.. If we use the sfdx command this way :
sfdx force:package:version:create -p CurrencyTest -x -w 30

This may fail with a dependent feature error , eg : multicurrency related error :
no CustomField named sfdx__c.CurrencyIsoCode found

Cause:
The metadata / feature related dependencies not found while creating package version so that causes an error , so we need to find the related dependency of feature / metadata to fix this,
Lösning

To Fix this you need to follow the below steps :


Step 1: Add the Required Feature to the Scratch Org Definition File
Add the required features to the features array. For example, to enable Multi-Currency: add "MultiCurrency" to the features list. For Process Builder: add "ProcessBuilder". Save the file. Refer to the Scratch Org Definition Configuration Values documentation (Scratch Org Def File) for the full list of supported features.


Step 2: Specify the Definition File in the Package Version Create Command
When running the package version create command, explicitly reference the definition file using the -f flag:
sfdx force:package:version:create -p CurrencyTest -x -w 30 -f config/project-scratch-def.json

Including the -f flag ensures that Salesforce validates the package metadata against a scratch org that has all required features enabled, preventing the dependency error.

Knowledge-artikelnummer

000396083

 
Laddar
Salesforce Help | Article