The Winter ’25 Salesforce release is rolling out between September and October 2024, bringing exciting updates and new features designed to enhance developer productivity. From adding advanced AI features to boosting platform capabilities, this release is packed with valuable tools for Salesforce developers. Let’s explore some of the key updates.
Pic Courtsey: Salesforce
Apex Improvements
-
Preventing Collection Modification During Iteration
In previous Apex versions, developers could modify a set while iterating over it, which often led to unpredictable results like skipped elements or repeated processing. From API version 62.0 onward, attempting to modify a set during iteration will throw a System.FinalException: Cannot modify a collection while it is being iterated
. This change ensures smoother and more reliable code execution.
Example:
Set<String> names = new Set<String>{'Alice', 'Bob', 'Charlie'}; for (String name : names) { if (name.startsWith('A')) { names.remove(name); // This throws an exception in API v62.0 } }
- Improved SOQL Error Messages
Developers will now receive clearer and more informative error messages for invalid dynamic SOQL queries. These improvements help pinpoint issues faster. It will Improve overall development efficiency. Refer the List of error messages.
-
Support for Negative Currency Values in Dynamic SOQL
Handling negative currency values in dynamic SOQL queries is now possible, provided your organization uses MultiCurrency. Previously, queries involving negative amounts would result in an error, but that’s no longer the case.
Example:
System.debug(Database.query('SELECT Amount FROM Opportunity WHERE Amount < USD-5000'));
-
Free Tier Event Monitoring for Apex Errors
Apex Unexpected Exception event logs are now available for free, allowing you to track and troubleshoot unhandled exceptions more effectively. While email notifications are still limited, this new feature helps you dig deeper into the root causes by downloading CSV logs for further analysis.
-
Mock SOQL Tests for External Objects
Testing SOQL queries for external objects is now easier with the new SoqlStubProvider
class, which lets you mock SOQL responses for external objects during testing. Refer to the example code for more details.
LWC Enhancements
-
Local Development for LWC (Beta)
Local Development (Beta) is now available in Winter ’25, allowing you to preview Lightning Web Components (LWC) as you code, without the need for page refreshes. With hot module reloading and WebSockets, you can instantly see the effects of your code on LWR sites, mobile apps, and the Lightning Experience.Refer to the Documentation for more details.
-
API Version 62.0 Updates for LWC
With API version 62.0, Salesforce is introducing significant improvements to LWC. To update the component version, modify the API version in the component’s .js-meta.xml file. The following features are available only if your LWC component version is 62.0 or higher.
-
Class Object Bindings for Managing Styles
In LWC API version 62.0 and later, developers can now manage multiple classes on an element using a JavaScript array or object. This eliminates the need to concatenate class names, simplifying the process of applying multiple styles dynamically.
Let’s say you have a button with the below HTML markup:
<div class={computedClassNames}>Evaluate some classes here</div>
Below is a JavaScript class that generates computedClassNames
as arrays containing object types.
import { LightningElement } from "lwc"; export default class extends LightningElement { position = "left"; fullWidth = true; hidden = false; get computedClassNames() { return [ "div__block", this.position && `div_${this.position}`, { "div_full-width": this.fullWidth, hidden: this.hidden, }, ]; } }
With API version 62.0, this code would render the following HTML:
<div class='div__block div_left div_full-width'>Evaluate some classes here</div>
In version 61.0, it would render incorrectly as:
<div class='div__block,div_left,[object Object]'>Evaluate some classes here</div>
The documentation includes a useful table that illustrates how class bindings are rendered in API version 62.0 and later compared to version 61.0, using various data types.
-
New this.style Property
Starting with version 62.0, LWC now provides direct access to a component’s CSSStyleDeclaration(see docs)via the new this.style property. This property can be used in both light DOM and shadow DOM, simplifying the process of managing styles.
Example:
import { LightningElement } from "lwc"; export default class MyComponent extends LightningElement { static renderMode = "light"; // default is 'shadow' setStyle() { this.style.setProperty('color', 'red'); this.style.setProperty('border', '1px solid #eee'); console.log(this.style.color); // logs "red" } renderedCallback() { this.style.color = 'red'; } }
The this.style property streamlines the process of applying inline styles directly to the component’s root, improving readability and maintainability.
-
New this.hostElement Property
The this.hostElement property allows developers to easily access the parent element of an LWC component. Irrespective of light or shadow DOM. This property replaces the older this.template.host and simplifies accessing the parent element. Example:
import { LightningElement } from "lwc"; export default class MyComponent extends LightningElement { static renderMode = "light"; // default is 'shadow' renderedCallback() { console.log(this.hostElement); // logs the parent element console.log(this.hostElement.tagName); // logs C-LIGHT } }
This enhancement is particularly useful when needing to interact with the parent element or modify its attributes dynamically.
-
TypeScript Support (Developer Preview)
Salesforce has introduced TypeScript support for LWC, providing enhanced type safety and better tooling for development. Developers can write LWC components in TypeScript and compile them to JavaScript, benefiting from improved error checking and code completion.
-
GraphQL Wire Adapter Support for Experience Cloud
The lightning/uiGraphQLApi wire adapter is now supported in LWCs built for Experience Cloud LWR sites. This expands the capabilities of Experience Cloud development, allowing developers to take full advantage of GraphQL in building complex data queries. Checkout LWC Recipes doc to learn how to build with lightning/uiGraphQLApi
Data Cloud Updates
-
Data Cloud Sandboxes (Beta)
With the Winter ’25 release, Salesforce introduces Data Cloud sandboxes in Beta. These sandboxes support various Data Cloud features, allowing developers to experiment with and build on the platform in a controlled environment.
-
Vector Search and Hybrid Search
Data Cloud now allows for vector and hybrid search, enabling you to index and search unstructured data more effectively. Vector search is semantically aware, making queries more precise . Hybrid search combines vector and keyword searches for better outcomes.
Example:
SELECT v.score__c, c.SourceRecordId__c FROM vector_search(table(CaseComments_index__dlm), 'power failure', '', 10) v JOIN CaseComments_chunk__dlm c ON v.RecordId__c = c.RecordId__c JOIN CaseComments__dlm casecomment ON c.SourceRecordId__c = casecomment.Id__c ORDER BY 1 DESC
-
Retrieval Augmented Generation (RAG)
RAG, introduced in August 2024, enhances AI-generated responses by incorporating context from unstructured data like emails and knowledge bases. This results in more accurate, contextually relevant AI interactions.
-
Data Kit Metadata Locking
You can now lock custom metadata within Data Cloud data kits, preventing unwanted modifications by subscribers. This feature increases control over data package integrity.
AI and Agentforce Updates
-
Agentforce Agents
Agentforce Agents, introduced in Winter ’25, are AI-driven systems that can autonomously perform tasks on the Salesforce platform. Agentforce Agents can assist users (Einstein Copilots) or operate independently.
-
Agent Builder
Previously known as Copilot Builder, Agent Builder now enables developers to create and customize Agentforce Agents by defining topics and actions with prompts, flows, and Apex. The introduction of topics allows agents to group and prioritize tasks more efficiently, improving decision-making accuracy.
-
Advanced Planner
The new Advanced Planner enhances agent performance by allowing for more frequent and reactive decisions based on user input, resulting in more dynamic and accurate task planning.
-
Models API (Beta)
The Models API (Beta) connects Salesforce applications to large language models (LLMs) from partners like Anthropic, Google, and OpenAI, enabling developers to integrate cutting-edge AI capabilities into their Salesforce solutions.
Platform Development Tools
-
Einstein for Developers (Beta)
The Dev Assistant (Beta) in Einstein for Developers introduces a range of helpful features, including code suggestions, explanations, and even code fixes contextualized with your org’s metadata. This tool will streamline development, offering smart insights into Apex and LWC code.
-
Salesforce CLI Updates
Salesforce CLI continues to evolve with regular updates. Developers should stay informed of the latest releases to ensure they are leveraging all available tools for improving their development workflow.Some of the recent significant enhancements include:
- The ability to export up to five levels of child objects in a query using the data export tree –plan command.
- The data import tree –plan command now supports files with over 200 records.
- Running the data import tree command with the –file flag now utilizes parallel uploads, enhancing performance.
- A new command for file uploads has been introduced. For example, to upload a file and associate it with a parent object, you can use: sf data create file –file astro.png –title Astro.png –parent-id a03fakePIA3.
- The installation process for the Salesforce CLI has been optimized for speed.
- A new beta command, api request rest, allows you to send REST calls to your organization.
This overview highlights the most significant features and enhancements for developers in Salesforce’s Winter ’25 release. Each of these improvements is designed to streamline development, boost productivity, and help teams build more advanced, AI-powered solutions on the Salesforce platform. Be sure to review the full release notes and try out these exciting new capabilities in your sandbox.