Sometimes it is required to find out current API version of your Org (Sandbox/Dev Org/Production) in order to perform some operations like making HTTP request to SFDC URI which contains api version.
As of now, I was not able to find any method in apex through which I can get my org current api version So I have created utility class which uses Tooling API to get all version related to org and returning latest/current api version like 39.0,40.0 etc.
Below is complete code for this.
You can run below scripts in developer console to get current API version after saving above class in your org.
Decimal currentAPIVersion = UtilityClassForSFDC.findAPIVersionOfOrg();
system.debug('***************currentAPIVersion:'+currentAPIVersion);
After running you may get "Unauthorized endpoint url". Just add your SFDC base URL in remote site setting to avoid this exception.
Hope this will help!!!
Looking forward for your comments and suggestions..
DYNAMIC APEX IN SALESFORCE
SOQL INJECTION IN SOQL
CUSTOM METADATA AND CUSTOM SETTINGS IMPLEMENTATION TRICKS
SMART TABLE USING ANGULARJS IN VISUALFORCE PAGE
REST API TUTORIAL FOR SALESFORCE
VISUALFORCE COMPONENT FOR RECORD STATUS BAR
FETCHING FILE FROM EXTERNAL/PUBLIC URL AND STORING IT IN SALESFORCE
As of now, I was not able to find any method in apex through which I can get my org current api version So I have created utility class which uses Tooling API to get all version related to org and returning latest/current api version like 39.0,40.0 etc.
Below is complete code for this.
You can run below scripts in developer console to get current API version after saving above class in your org.
Decimal currentAPIVersion = UtilityClassForSFDC.findAPIVersionOfOrg();
system.debug('***************currentAPIVersion:'+currentAPIVersion);
After running you may get "Unauthorized endpoint url". Just add your SFDC base URL in remote site setting to avoid this exception.
Hope this will help!!!
Looking forward for your comments and suggestions..
More Blogs>>:
USING DATABASE.UPSERT WITH EXTERNAL ID
DYNAMIC APEX IN SALESFORCE
SOQL INJECTION IN SOQL
CUSTOM METADATA AND CUSTOM SETTINGS IMPLEMENTATION TRICKS
SMART TABLE USING ANGULARJS IN VISUALFORCE PAGE
REST API TUTORIAL FOR SALESFORCE
VISUALFORCE COMPONENT FOR RECORD STATUS BAR
FETCHING FILE FROM EXTERNAL/PUBLIC URL AND STORING IT IN SALESFORCE
Hi There,
ReplyDeleteThis is indeed great! But I think perhaps you are generally referring How to find Salesforce API version of your Org in Apex which is getting unsustainable.
I have an apex datatable returning some User fields from a list in my apex class. I would like to include a column "This Month's Sales" which would return the total $ of opps closed won this month. I can run the SOQL in my class but I'm not sure how to get the correct result per user into the table, i.e. how to put it into the correct row and column in my table. Can I attach this $amount to each user without creating a custom field?
I am so grateful for your blog. Really looking forward to read more.
Kind Regards,
Preethi.
Thank you for this!! Works great for building callouts in my org :)
ReplyDeleteYou have done a great job on this article. It’s very readable and highly intelligent. You have even managed to make it understandable and easy to read. You have some real writing talent. Thank you. csgo high tier accounts
ReplyDeleteCSGO Medal Accounts have high steam levels and good coins, badges, and medals. The steam level of these accounts ranges from 10 to 500. You don't need to pay more for these steam-level accounts. If you buy level-up sets, it will have cost more than the price of these VIP csgo accounts. CSGO High Tier Prime Accounts From WayToSmurf
ReplyDeleteBuy Valorant Smurf Accounts from the best gaming marketplace. Valorantatsmurfshop provides best valorant ranked accounts:
ReplyDeleteYou can find three types of valorant accounts
NA Region Valorant Accounts
EU Region Valorant Accounts
SEA Region Valorant Accounts
PUBG Mobile is littered with vehicles, but most are abandoned and too damaged to be drivable. Learn the visual profiles of the drivable vehicles so you don't waste time. pubg mobile accounts
ReplyDeleteHOW I GO MY DESIRED XMAS LOAN AMOUNT $520,000.00 FROM A RELIABLE AND TRUSTED LOAN COMPANY LAST WEEK. Email for immediate response: drbenjaminfinance@gmail.com
ReplyDeleteHello everyone, Am here to testify of how i got my loan from BENJAMIN LOAN FINANCE(drbenjaminfinance@gmail.com) I don't know if you are in need of an urgent loan to pay bills, start business or build a house, they offer all kinds of loan. So feel free to contact Dr.Benjamin Scarlet Owen he holds all of the information about how to obtain money quickly and painlessly via Email: drbenjaminfinance@gmail.com
and consider all your financial problems tackled and solved. Share this to help a soul right now, Thanks
Nice! Very useful information. Munafa Wala Loan agency in Jaipur provide loan at low interest rate Personal Loan Agency in jaipur
ReplyDelete