New Apex Features From Salesforce Winter ’25 Release

by Sudipta Deb | Oct 3, 2024 | Advanced Apex, Apex, dynamic apex, Salesforce, Salesforce Winter 25 Release, SOQL | 0 comments

Sudipta Deb

Sudipta Deb

Founder of Technical Potpourri, Co-Founder of Shrey Tech, Enterprise Cloud Architect

Salesforce Winter '25 Release is here. I have published few dedicated posts and videos covering new features from Winter'25 release. If you haven't checked them out, please go ahead and check them below.

In today's blog post, I will share all the new Apex features that are coming along with the Winter 25 release. Please provide your feedback in the comment, and don't forget to subscribe to my youtube channel and blog pot.

Watch The Video Or Read The Article (Or Do Both smile)

The form you have selected does not exist.

Understand SOQL Error and Functionality Changes to Update Your Code

The biggest change that is coming is the support of negative currency value is dynamic SOQL queries. This is only applicable if the multi-currency is enabled in your org. For example, below query will fetch all oprtunities where amount is less than -CAD - 1000.

Not only that, the error messages become more self-explanatory.

  • SELECT Id FROM Account USING everything

    Old: unexpected token: '<EOF>'

    New: unexpected token: 'everything'

  • SELECT ParentId, Value FROM InteractionRefOrValue WHERE ParentId IN ()

    Old: unexpected token: ')'

    New: unexpected token: 'ParentId IN ()'

  • SELECT FROM ServicePresenceStatus

    Old: unexpected token: 'FROM'

    New: unexpected token: 'SELECT FROM'

Improved Consistency When Iterating Sets

Starting version 62, modifying elements of a set while iterating the set in a for or foreach() loop throws an exception. For example, below code will not provide you any error when the API version is below 62, but you might get some unexpected result. Starting version 62, this code snippet will give you System.FinalException exception stating that you cannot modify a collection while it is being iterated.

Write Mock SOQL Tests for External Objects

When we write any Apex class which involves some sort DML operation around the External object, we need to write the test classes as well. Writing test class is needed to make sure atleast 75% of the code is covered in the test class with both positive, negative and bulkified scenarios. In case of SOQL statements, we normally create the test data in the test setup method and query them in the test methods. But in case of SOQL which involves External object, we can not do that and also we can not directly query the External objects. But test coverage is needed for the Apex class to be deployed in Production. 

In Winter 25 Release, Salesforce brings the solution to this problem. Now we can write mock SOQL statements for External Objects.

I have published a dedicated blog post and youtube video covering this topic. You can find it below

Track Apex Unexpected Exceptions with Free-Tier Event Monitoring

You can now take advantage of free-tier access to Event Monitoring, and track unhandled exceptions in Apex code execution instead of relying only on unhandled exception emails. You can now troubleshoot your Apex code by analyzing the information captured in the event log files for the Apex Unexpected Exception event type

Final Thoughts

That's all for today. I hope with this blog post and youtube video, you will be able to figure out all the cool apex enhancements that are coming with Winter 25 release. In next couple of days, I will bring more Winter 25 features in this blog as well as my youtube channel. So it is highly recommended that you please subscribe to my channel and blog to come to know about all the nice features. Thank you!!

Disclaimer

This article is not endorsed by Salesforce, Google, or any other company in any way. I shared my knowledge on this topic in this blog post. Please always refer to Official Documentation for the latest information.

0 Comments

Leave a Reply

Written by Sudipta Deb

Enterprise Cloud Architect, Content Creator, 20x Salesforce Certified, 1x Google Cloud Certified, 2x Copado Certified

Related Posts

Salesforce Cancels the “Permissions in Profiles” Retirement: What It Means for Admins and Architects

Salesforce Cancels the “Permissions in Profiles” Retirement: What It Means for Admins and Architects

For the last few years, Salesforce administrators, architects, and security teams have been preparing for a major platform change: the retirement of permissions managed directly through Profiles. Salesforce had previously announced plans to move organizations toward a Permission Set–led security model, with enforcement expected to begin around the Spring ’26 timeframe.

read more...

0 Comments

Leave a Reply