sf package version create, Apex tests that assert isUpdateable() returns false for a custom field (e.g., custom_field__c) fail with an error similar to:System.AssertException: Assertion Failed: custom_field should be false. Profile: Standard User. FLS EDIT sources: PermSet: X00ex00000018ozq_128_09_04_12_10 | IsOwnedByProfile: true | Profile: Standard User
sf package version create runs, the dependency package (e.g., a Base package) is installed into the build org with Security Type = Full. This means the package is installed for all users, and its field permissions are applied broadly — including to profile-backed Permission Sets (system-generated PermSets prefixed with X00e...) associated with standard profiles such as Standard User, System Administrator, etc.isUpdateable() evaluates the user's effective permissions (Profile + all assigned Permission Sets, including profile-backed ones)Option 1: Replace isUpdateable() with a direct FieldPermissions query (Recommended)
Instead of relying on isUpdateable(), query FieldPermissions to evaluate only explicitly assigned (non-profile-backed) Permission Sets:
private static Boolean hasExplicitEditPermission(String sobjectType, String field) {
List<FieldPermissions> fp = [
SELECT PermissionsEdit
FROM FieldPermissions
WHERE SobjectType = :sobjectType
AND Field = :field
AND PermissionsEdit = true
AND ParentId IN (
SELECT PermissionSetId
FROM PermissionSetAssignment
WHERE AssigneeId = :UserInfo.getUserId()
AND PermissionSet.IsOwnedByProfile = false
)
LIMIT 1
];
return !fp.isEmpty();
}
Replace the isUpdateable() checks in your production Apex class with this helper. To minimize SOQL usage, query the required field permissions once at the start of the transaction and cache results in a Map for reuse across multiple methods.
Option 2: Use unpackagedMetadata to separate strict FLS tests
Place FLS-specific test classes that rely on a controlled permission model in the unpackagedMetadata directory of your project:
"unpackagedMetadata": {
"path": "unpackaged"
}
unpackagedMetadata are deployed into the build org but NOT executed during sf package version createforce-app) are executed during package version creation validationunpackagedMetadata and run them locallyforce-app more generic to handle the build org's effective permission model
Option 3: Update test assertions to be agnostic to build-org profile behavior
Modify test logic to assert based on the business outcome (e.g., whether a field value was overridden) rather than asserting a specific FLS state. Since the effective permission model in the build org differs from a scratch org, tests that depend on isUpdateable() returning a specific value may be unreliable in this context.
005385922

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.