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
A guestA guest 

How can I find the current API Version in the salesforce

Hi Guyz,

I have a requirement that i will have to take the current API Version. Then i need compare with the Apex Class, components Api versions, to make sure whether they are in current or in old API version.

Please help me out ,how can i find that programmatically,Thanks in Advance.
Best Answer chosen by A guest
Khan AnasKhan Anas (Salesforce Developers) 
Hi,

Greetings to you!

Please refer to the below links which might help you further with the above requirement.

Current API version of your Org:
https://www.sfdcstuff.com/2017/06/how-to-find-salesforce-api-version-of.html

https://salesforce.stackexchange.com/questions/116645/find-current-api-version-in-apex

https://salesforce.stackexchange.com/questions/194030/latest-api-version-in-apex-class

Apex class API version:
SELECT Name, ApiVersion FROM ApexClass

Lightning Component API version:
SELECT DeveloperName, ApiVersion FROM AuraDefinitionBundle

​​​​​
I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas

All Answers

Khan AnasKhan Anas (Salesforce Developers) 
Hi,

Greetings to you!

Please refer to the below links which might help you further with the above requirement.

Current API version of your Org:
https://www.sfdcstuff.com/2017/06/how-to-find-salesforce-api-version-of.html

https://salesforce.stackexchange.com/questions/116645/find-current-api-version-in-apex

https://salesforce.stackexchange.com/questions/194030/latest-api-version-in-apex-class

Apex class API version:
SELECT Name, ApiVersion FROM ApexClass

Lightning Component API version:
SELECT DeveloperName, ApiVersion FROM AuraDefinitionBundle

​​​​​
I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas
This was selected as the best answer
A guestA guest
Hey Thanks a lot khan. 

 Below link helped me to achieve the requirement.

Current API version of your Org:
https://www.sfdcstuff.com/2017/06/how-to-find-salesforce-api-version-of.html
Deepali KulshresthaDeepali Kulshrestha
Hi,
Greetings to you!
To identify your current API version

Classic UI:
Navigate to Setup and enter API into the 'Quick Find' search box. Then click API under 'Develop.' From there click Generate Enterprise WSDL and on the next page listing 'Installed Packages' click the Generate button.

On the resulting page your current API version will be listed in the text or comment sections near the top. Example: 'Salesforce.com Enterprise Web Services API Version 35.0'

Note: If you're in a sandbox environment [Do not save, hit Cancel]

Go to Setup | Build | Develop | Apex Classes. Then click the New button, and then click Version Settings.
API Version 38.0 = Winter '17
API Version 39.0 = Spring '17
API Version 40.0 = Summer '17
API Version 41.0 = Winter '18
API Version 42.0 = Spring '18
API Version 43.0 = Summer '18
API Version 44.0 = Winter '19
API Version 45.0 = Spring '19

Lightning UI:
Click the gear Icon [ Setup ] | In the 'Quick Find' search box, enter API. Then click Generate Enterprise WSDL and finally click the Generate button.

Note: If you're in a sandbox environment [Do not save, hit Cancel]

Click the gear Icon [ Setup ] | In the 'Quick Find' search box, enter Apex Classes. Then click the New button. Finally, click on Version Settings.

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Deepali Kulshrestha.
Ajay K DubediAjay K Dubedi
Hi A,

Salesforce current API Version:
For knowing current API Version in the salesforce you can always goto setup >  API > Generate Partner WSDL -- the frst couple of lines are comments and it will tell your c API Version.

Apex class current API Version:
use below query for getting apex class name which has 46 API Version.
select name from ApexClass where APIversion=46

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks,
Ajay Dubedi