How We Handle Profile Settings in Unlocked Packages
During package installation, the preserved profile settings are applied only to existing profiles in the subscriber org. The profile itself isn’t installed in the subscriber org.
To control which profile settings are included, use the scopeProfiles parameter in the project configuration file.
When you select… | The packaged profile settings are applied to... | This installation option is available via… |
---|---|---|
Install for Admins Only | The System Administrator profile in the subscriber org. CRUD access to custom objects is granted automatically to the System Administration profile. |
The default behavior for CLI-based package installs is to install for admins only. |
Install for All Users | The System Administrator profile and all cloned profiles in the subscriber org. CRUD access to custom objects is granted automatically to the System Administration profile, and all cloned profiles. Standard profiles can’t be modified. |
To install for all users via the CLI, include the security type parameter. sf package install --security-type AllUsers |
Install for Specific Profiles | Specific profiles in the subscriber org. This selection lets the person installing your package determine how to map the profile settings you packaged to specific profiles in their org. |
Not available for CLI-based package installations. |
- From Setup, enter Profile in the Quick Find box, and then locate and inspect the profiles you selected during package installation.
- Check whether your profile settings have been applied to that profile.
Repeat this step for any other profile you expect to contain your profile settings. Don’t look for the profile name you created; we apply profile settings to existing profiles in the subscriber org.
Whenever possible, use package permission sets instead of profile settings. Subscribers who install your package can easily assign your permission set to their users.
Retain License Settings in Unlocked Packages
By default, license settings in profiles are removed during package creation. To retain these settings, specify the includeProfileUserLicenses parameter in your sfdx-project.json file. In this scenario, the license settings are retained and applied to the profiles in the subscriber org that are selected during package installation.
"packageDirectories": [
{
"package": "PackageA",
"path": "common",
"versionName": "ver 0.1",
"versionNumber": "0.1.0.NEXT",
"default": false,
includeProfileUserLicenses: true
}
]