I am trying to move around 80 classes and visualforce pages from sandbox to production by using change set but i got an error

One or more components failed Version Compatibility Check. This change set contains components that require the "30.0" or higher platform version. Please select an organization with a platform version of "30.0" or higher, or remove all incompatible components.

I tried below from developer console,

List<ApexClass> apex = [select name,apiversion from ApexClass where apiversion=30];
for(ApexClass a:apex)
    a.apiversion = 29.0;
update apex;

Let me know if there is any other solution except changing the version manually by going to each class/page.

2 Answers 2


There are two issues you are encountering:

1) You can't use DML on the ApexClass object. To do this programmatically you would need to use the Tooling API, the Metadata API, or Apex API.

2) The error suggests you have code that contains features that are not available in any API version below 30. You will either need to remove this functionality from the offending classes or wait until the target org gets updated to version 30.

If you wanted to change the version of Apex code in mass I would suggest some copy paste or a script to change the file versions locally, then use the Ant Migration Tool to deploy the changed metadata files to salesforce.


Probably you deployed the change set to another sandbox on v30.0 first, which made the change set v30.0 as well.

Make a new clone of the change set and deploy to production. Then it should work.

(do note that a fresh copy of the code will be made from your sandbox)

  • version was already 30.
    – snehakem
    Apr 11, 2014 at 13:32
  • 1
    yes but that should not matter, unless there is indeed a Spring '14 component in your package. But then resetting the API to 29.0 on each component won't work either. Did you try my solution? Apr 11, 2014 at 13:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .