Package2Version

Represents a second-generation package version in a Dev Hub org. Values for all fields except for Tag and Branch are visible to the subscriber.

Version 

Introduced in API version 40.0.

Supported SOAP API Calls 

describeSObjects(), query(), retrieve(), update()

Supported REST API Methods 

GET, HEAD, PATCH, Query

Fields 

AncestorId 

  • Type: reference

  • Required: No

  • Properties: Filter, Group, Nillable, Sort

  • Introduced: API version 48.0

  • Description: The ID of the immediate parent of the package version in the package ancestry tree.

  • Relationship name: Ancestor

  • Relationship type: relationship

  • Refers to: SubscriberPackageVersion

Branch 

  • Type: string

  • Required: No

  • Properties: Filter, Group, Nillable, Sort, Update

  • Description: The branch associated with this package version. Can be used to create a tree structure of inheritance.

This value is auto-populated from Package2VersionCreateRequest, but you can update it.

BuildDurationInSeconds 

  • Type: int

  • Required: No

  • Properties: Filter, Group, Nillable, Sort

  • Introduced: API version 51.0

  • Description: Measured in seconds, this field indicates how long the build for this package version took. This field is new in API version 51.0.

BuildNumber 

  • Type: int

  • Required: No

  • Properties: Filter, Group, Sort

  • Description: Part of the version number of a package version. The complete version number format is major.minor.patch (Beta build)—for example, 1.2.0 (Beta 5). For released packages, version numbers contain only major.minor.patch, or, if patch is 0, major.minor—for example, 1.2.

CodeCoverage 

  • Type: complexvalue

  • Required: No

  • Properties: Nillable

  • Introduced: API version 47.0

  • Description: Percentage of lines of Apex code in the package version that are covered by tests. The value is null if code coverage wasn’t run when the package version was created.

For second-generation managed packages, a minimum 75% code coverage is required for package version promotion.

CodeCoveragePercentages 

  • Type: complexvalue

  • Required: No

  • Properties: Nillable

  • Introduced: API version 55.0

  • Description: Provides code coverage details for each Apex class in the package version.

The value is null if code coverage wasn’t run when the package version was created, or if there’s no Apex code in the package.

ContainsPsld 

  • Type: boolean

  • Required: No

  • Properties: Defaulted on create, Filter, Group, Sort

  • Introduced: API version 66.0

  • Default value: false

ConvertedFromVersionId 

  • Type: reference

  • Required: No

  • Properties: Filter, Group, Nillable, Sort

  • Introduced: API version 49.0

  • Description: The subscriber package version ID (starts with 04t) of the first-generation managed package version that was converted.

This field is a relationship field.

Description 

  • Type: string

  • Required: No

  • Properties: Filter, Nillable, Sort, Update

  • Description: Description of the package.

EndToEndBuildDurationInSeconds 

  • Type: int
  • Required: No
  • Properties: Filter, Group, Nillable, Sort
  • Introduced: API version 61.0

HasMetadataRemoved 

  • Type: boolean

  • Required: No

  • Properties: Defaulted on create, Filter, Group, Sort

  • Introduced: API version 51.0

  • Description: For managed packages only, this field returns true when one or more managed metadata components included in the package version’s ancestor aren’t included in this package version. This field doesn’t apply to unlocked packages. Available in API version 51.0.

  • Default value: false

HasPassedCodeCoverageCheck 

  • Type: boolean

  • Required: No

  • Properties: Defaulted on create, Filter, Group, Sort

  • Introduced: API version 47.0

  • Description: Returns true if code coverage tests were run when the package version was created, and the resulting code coverage percentage is 75% or greater. Otherwise, returns false.

For second-generation managed packages, a minimum 75% code coverage is required for package version promotion.

  • Default value: false

HasVpi 

  • Type: boolean

  • Required: No

  • Properties: Defaulted on create, Filter, Group, Sort

  • Introduced: API version 67.0

  • Default value: false

InstallKey 

  • Type: string

  • Required: No

  • Properties: Filter, Group, Nillable, Sort, Update

  • Introduced: API version 41.0

  • Description: Installation key for creating the key-protected package. The default is null.

If you query for this value, the returned value is always null (for security reasons). The value can be set and reset but not read.

IsDeprecated 

  • Type: boolean

  • Required: No

  • Properties: Defaulted on create, Filter, Group, Sort, Update

  • Version: Deprecated package versions that have been installed in subscriber orgs continue to function, but new installations of deprecated package versions are blocked.

  • Description: Specifies whether this package version has been marked as deprecated (true) or not (false). The default value is false.

If you set IsDeprecated to true for a package, the package and all of its child package versions are deprecated.

If you set IsDeprecated to false for a package, the package and all of its child package versions are undeprecated. However, if IsDeprecated is explicitly set to true for a package version after its parent package is deprecated, the child remains deprecated even if you undeprecate its parent.

If you set IsDeprecated to false for a package version whose parent package is deprecated, the package version’s IsDeprecated value remains true until its parent is undeprecated.

  • Default value: false

IsPasswordProtected 

  • Type: boolean

  • Required: No

  • Properties: Defaulted on create, Filter, Group, Sort

  • Description: Specifies whether installation of this package version requires the user to provide an installation key (true) or not (false). The default value is false.

  • Default value: false

IsReleased 

  • Type: boolean

  • Required: No

  • Properties: Defaulted on create, Filter, Group, Sort, Update

  • Introduced: API version 43.0

  • Description: Indicates whether the package version is released (true) or in beta (false).

  • Default value: false

Language 

  • Type: string

  • Required: No

  • Properties: Filter, Group, Nillable, Sort

  • Introduced: API version 57.0

  • Description: The language for the package.

If a language wasn’t specified, the language defaults to the language of the Dev Hub user who created the package.

MajorVersion 

  • Type: int

  • Required: No

  • Properties: Filter, Group, Sort

  • Description: Part of the version number of a package version. The complete version number format is major.minor.patch (Beta build)—for example, 1.2.0 (Beta 5). For released packages, version numbers contain only major.minor.patch, or, if patch is 0, major.minor—for example, 1.2.

MinorVersion 

  • Type: int

  • Required: No

  • Properties: Filter, Group, Sort

  • Description: Part of the version number of a package version. The complete version number format is major.minor.patch (Beta build)—for example, 1.2.0 (Beta 5). For released packages, version numbers contain only major.minor.patch, or, if patch is 0, major.minor—for example, 1.2.

Name 

  • Type: string

  • Required: No

  • Properties: Filter, Group, Sort, Update

  • Description: Name of the package.

Package2Id 

  • Type: reference

  • Required: No

  • Properties: Filter, Group, Sort

  • Description: ID of the parent package (starts with 0Ho).

  • Relationship name: Package2

  • Relationship type: relationship

  • Refers to: Package2

PatchVersion 

  • Type: int

  • Required: No

  • Properties: Filter, Group, Sort

  • Description: Part of the version number of a package version. The complete version number format is major.minor.patch (Beta build)—for example, 1.2.0 (Beta 5). For released packages, version numbers contain only major.minor.patch, or, if patch is 0, major.minor—for example, 1.2.

Currently, the only valid value is 0.

ReleaseVersion 

  • Type: double

  • Required: No

  • Properties: Filter, Nillable, Sort

  • Introduced: API version 51.0

  • Description: Indicates the Salesforce release version used to create the package version. The value is in the format of a Salesforce API version number, for example, “51.0.” This field is new in API version 51.0.

SnapshotName 

  • Type: string

  • Required: No

  • Properties: Filter, Group, Nillable, Sort

  • Introduced: API version 58.0

  • Description: The name of the scratch org snapshot used when creating this package version.

SubscriberPackageVersionId 

  • Type: reference

  • Required: No

  • Properties: Filter, Group, Sort

  • Description: ID that subscribers use to install the package version (starts with 04t).

This value is read-only.

Tag 

  • Type: string

  • Required: No

  • Properties: Filter, Group, Nillable, Sort, Update

  • Description: The package version’s tag.

This value is auto-populated from Package2VersionCreateRequest, but you can update it.

TotalNumberOfMetadataFiles 

  • Type: int
  • Required: No
  • Properties: Filter, Group, Nillable, Sort
  • Introduced: API version 64.0

TotalSizeOfMetadataFiles 

  • Type: long
  • Required: No
  • Properties: Filter, Group, Nillable, Sort
  • Introduced: API version 64.0

ValidatedAsync 

  • Type: boolean

  • Required: No

  • Properties: Defaulted on create, Filter, Group, Sort

  • Introduced: API version 61.0

  • Description: If true, a new package version is created before package validations complete.

The default value is false.

For more information on async validation, see Create and Update Versions of a Second-Generation Managed Package

  • Default value: false

ValidationSkipped 

  • Type: boolean

  • Required: No

  • Properties: Defaulted on create, Filter, Group, Sort

  • Introduced: API version 48.0

  • Description: If true, validation is skipped during package version creation. Skipping validation reduces the time it takes to create a new package version, but package versions created without validation can’t be promoted to the released state.

The default value is false.

You can’t specify both skip validation and code coverage, because code coverage is calculated during validation.

  • Default value: false

DID THIS ARTICLE SOLVE YOUR ISSUE?
Let us know so we can improve!