function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
neerureddyneerureddy 

Purpose of Version Setting

Hi ,

 

Why should we need to set version for Apex Triggers and classes? What is the purpose of it?

 

Thanks,

Neeru.

Best Answer chosen by Admin (Salesforce Developers) 
neerureddyneerureddy

Hi werewolf,

 

I appreciate your help.I am very much clear about it now.

 

Thanks,

neeru.

All Answers

werewolfwerewolf

Each new release of Apex has a version so that it doesn't break code written prior to that.

 

Let's just say, for example, that today there's a class called Foo with a method called bar(), and bar() takes no parameters.  Today's Apex version is 17.0.  You write some code using bar() with no parameters.

 

Now Salesforce.com pushes out a new release.  In this new release, bar() takes one parameter.  The new release of Apex is version 18.0.

 

What will happen to your code, which was using bar() with no parameters?  Will it break?  No, because you are using Apex version 17.0, and in the 17.0 version, bar() takes no parameters.  It will only break if you try to update your Apex class to use version 18.0 -- then  you'll need to add a parameter there.

 

This versioning system is how Salesforce.com ensures that it does not break its customers' customizations when it pushes out new releases.

neerureddyneerureddy

Hi werewolf,

 

I appreciate your help.I am very much clear about it now.

 

Thanks,

neeru.

This was selected as the best answer