+ Start a Discussion

Managed package versions and sandboxes


I have a production org that contains a managed package that has had numerous versions created, some of which have been installed and some of which have been skipped.

At some point, a piece of Apex code was created in the org that used the managed package, tieing it to the version of the managed package that was installed at the time.

I am now in the position that I need to update that code, so I have created a sandbox to make my changes in.  However, when I try to save that code, I get "The specified Package Version number does not exist for that Package ...", even though I haven't changed any of the metadata.

Just to explain in a bit more detail, assume that the first version of the managed package that was installed in the production org was 1.10.  This was subsequently updated to version 1.20.  At that point the Apex code was created.  The managed package was then updated to version 1.30, but the code was left unchanged, tied to version 1.20.

I now create a sandbox and try to edit the code, but it complains that version 1.20 does not exist.

Unfortunately, I need to edit the code, but keep it using version 1.20 of the package.  Is that possible?



Check on Alias of 1.2 and if same alias name is used in your current code. Usually sometime company change alias as release happens from different orgs for same of the providers while most of the time it is same. So go to installed packages then look at 1.2 and it's alias. Once you get it then look at apex code and if it is using same alias when creating object of those managed classes, etc.

Unfortunately that isn't the issue. 

If I edit the Apex code in the sandbox, only a limited number of versions of the managed package are available in the "Version Settings" tab.  It does not include the version that the code was created under.

My feeling is that the sandbox only includes a limited number of previous versions of a managed package, regardless of which versions are actually used.  However, it would be nice to be proved wrong.