5

My employer has a fair amount of Apex code that was written for us three to five years ago. We haven't been updating the API versions of the older classes and new code has been added, so we have quite a mix of API versions out there (versions 13-30).

This question got me to thinking about how best to bring the versions up to date. How should we approach this?

  • Update everything to the latest version all at once.
  • Update the oldest classes to some intermediate version(s) first. (if so, which)
  • Update classes to the latest version one at a time (recognizing that dependencies may force other updates)
  • Some other process not listed here

Note: Alan Morey has compiled a list of where to find the past Salesforce release notes here.

3
  • 1
    List of past Release Notes salesforce.stackexchange.com/questions/40411/…. Reviewing these and comparing API changes to code usage would be a start.
    – Alan Morey
    Commented Jun 13, 2014 at 0:10
  • This list will certainly be useful. Do you mind if I edit my question to include it?
    – Jagular
    Commented Jun 13, 2014 at 0:12
  • Don't mind at all
    – Alan Morey
    Commented Jun 13, 2014 at 13:55

1 Answer 1

3

I think the way that I would approach this is one at a time, updating each class one by one to the latest API version and resolving issues as they arise. I'm guessing that the biggest changes you will face will be in the following areas:

  • Test data isolation - After (something like) version 24.0 of the API, tests no longer see all data in the database. If any of your unit tests rely on data in the instance, they'll likely start failing.
  • Inability to include both tests and code in the same class. In the latest API, tests must be in their own class and won't compile if they are included in a class that is not marked as @isTest at the class declaration
  • Make sure with or without sharing is explicitly declared on each class as what is implied without this keyword has changed subtly over the API versions.

I'm sure there is more but that's how I would approach it.

1
  • Also .. Note as of Summer 14, you won't need SeeAllData=true if your tests need to create custom pricebooks / pricebookEntries (i.e. v31 for the testmethod)
    – cropredy
    Commented Jun 14, 2014 at 0:00

You must log in to answer this question.

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