Winter'23 Release Notes

Published in Release Notes

The Sandbox Preview window for Winter ‘23 begins on August 11, 2022. If you would like your sandbox to take part, it must be active on a preview instance before then.

1. Write Clear and Intentional Apex Assertions

Improve the readability of your Apex code by using the assert methods in the new System.Assert class that fit the exact conditions that you’re checking for. Salesforce still support the existing System class assert methods. But Salesforce also recommend that you start using the new ones soon and that you update your existing code to use them.

For example, to assert whether two values are equal, use the Assert.areEqual() method, which is equivalent to the existing System.assertEquals():

String sub = 'abcde'.substring(2);
Assert.areEqual('cde', sub); 
Here’s an example of checking for null values.
String myString = null; 
Assert.isNull(myString, 'String should be null');
This example checks that exceptions are thrown from a method you’re testing and that they’re of the expected type.
try {
    methodUnderTest();
    Assert.fail('Exception failure is always an option');
} catch (Exception ex) {
    Assert.isInstanceOfType(ex, DmlException.class);
    // Additional assertions
}
Use the new System.Assert class, which includes these methods.

2. Enable Third-Party Integrations with Light DOM (Generally Available)

Lightning web components render in shadow DOM by default, providing strong encapsulation but posing challenges for global styling and many third-party integrations. With light DOM, your component markup is attached to the host element instead of its shadow tree. You can then access it like any other content in the document host.

Light DOM allows third-party tools to traverse the DOM, enabling standard browser query APIs like querySelector and querySelectorAll, without traversing the shadow root. It also facilitates global styling so you can apply custom branding to your components and child components easily.

To enable a component to render in light DOM, set the renderMode static field in your component class.

import { LightningElement } from 'lwc';

export default class LightDomApp extends LightningElement {
    static renderMode = 'light'; // the default is 'shadow'
}
Use the lwc:render-mode template directive on the <template> tag of your component.
<template lwc:render-mode='light'>
    <my-header>
        <p>Hello World</p>
    </my-header>
</template>
A light DOM component can contain a shadow DOM component. Similarly, a shadow DOM component can contain a light DOM component. However, base Lightning components always render in shadow DOM. Restricting light DOM to specific namespaces isn't supported. LWC doesn't scope styles automatically for you. To prevent styles from bleeding in or out of a component, use a *.scoped.css file to implement scoped styles for a component.

IMPORTANT Salesforce doesn't recommend using light DOM if you're working with sensitive data. Using light DOM exposes your components to DOM scraping. You don't get the benefits that come with shadow DOM encapsulation, which prevents unauthorized access into the shadow tree.

3. Create Overlays with the New Modal Component

Use modals to interrupt a user’s workflow and draw attention to an important message. A modal, which displays the message on top of the current app window, requires a user to interact with it to regain control over the app. To create a modal component, import LightningModal from lightning/modal in your JavaScript file. Then, create a component class that extends LightningModal.

/* c/myModal.js */

import { api } from 'lwc';
import LightningModal from 'lightning/modal';

export default class MyModal extends LightningModal {

    handleOkay() {
        this.close('okay');
    }
}
This component doesn’t use a lightning-modal tag. Instead, the modal’s HTML template uses helper lightning-modal-* components to make the modal’s header, footer, and body. The lightning-modal-body component is required, and the others are optional.
<!-- c/myModal.html -->

<template>
    <lightning-modal-header label="My Modal Heading"></lightning-modal-header>
    <lightning-modal-body>This is the modal’s contents.</lightning-modal-body>
    <lightning-modal-footer>
        <lightning-button label="OK" onclick={handleOkay}></lightning-button>
    </lightning-modal-footer>
</template>

4. Synchronize Component Data Without a Page Refresh by Using RefreshView API (Pilot)

Whether user-driven or app-invoked, the ability to synchronize data without reloading an entire page is a key user experience requirement. The new lightning/refresh module and RefreshView API provide a standard way to refresh component data in LWC and Aura. Previously, LWC lacked a data refresh API, and Aura only supported the legacy force:refreshView, which doesn’t meet the requirements of modern web development. RefreshView API’s detailed control of refresh scope lets developers create refined user experiences while maintaining backward compatibility.

RefreshView API updates the data for a specific hierarchy of components, known as a view, without reloading an entire page. This refresh ensures complete synchronization with data externally sourced by components in that view. RefreshView API can refresh data for Salesforce platform containers and custom components.

Pilot feature

Close

NOTE This feature is not generally available and is being piloted with certain Customers subject to additional terms and conditions. It is not part of your purchased Services. This feature is subject to change, may be discontinued with no notice at any time in SFDC’s sole discretion, and SFDC may never make this feature generally available. Make your purchase decisions only on the basis of generally available products and features. This feature is made available on an AS IS basis and use of this feature is at your sole risk.

5. Build Components in Mixed Shadow Mode (Beta)

With mixed shadow mode, Lightning web components can use native shadow DOM even when the synthetic shadow polyfill is applied. Mixed shadow mode is disabled by default. Contact Salesforce Customer Support to enable mixed shadow mode.

To enable mixed shadow mode on a component, set the static shadowSupportMode property to any.

// native.js
import { LightningElement } from 'lwc';

export default class NativeComponent extends LightningElement {
    static shadowSupportMode = 'any';
}
Valid values for shadowSupportMode include:
Lightning Experience and Experience Cloud include the synthetic shadow polyfill by default. When the polyfill is present, reset defaults to synthetic shadow. If the polyfill isn't present, such as in Lightning Out or LWC Open Source, shadowSupportMode has no impact and components render in native mode.

By default, slotted content is rendered in native shadow. Slotted content isn’t descended from the component it’s nested in, so you can slot synthetic shadow content into a native shadow component. This also means that slotted content isn’t affected by how your browser renders the #shadow-root of the component containing the slot. For example, if your browser renders a native component in synthetic shadow, native content slotted into that component is still rendered in native shadow.

Beta feature

Close

NOTE This feature is a Beta Service. Customer may opt to try such Beta Service in its sole discretion. Any use of the Beta Service is subject to the applicable Beta Services Terms provided at Agreements and Terms.

6. Secure Even More Apex Code with User Mode Database Operations (Beta)

Run more database operations in user mode with the enhanced user-mode support. The new Database methods support an accessLevel parameter so that you can run the operations in user mode instead of in the default system mode.

Salesforce introduced the user mode feature in the Summer '22 release with an initial set of overloaded System.Database methods that perform DML and query operations. Salesforce added these new methods in this release.



Beta feature

Close

NOTE This feature is a Beta Service. Customer may opt to try such Beta Service in its sole discretion. Any use of the Beta Service is subject to the applicable Beta Services Terms provided at Agreements and Terms.
Salesforce doesn’t guarantee general availability of this feature within any particular time frame or at all, and salesforce can discontinue it at any time. It’s offered as is and isn’t supported, and Salesforce has no liability for any harm or damage arising out of or in connection with it. You can provide feedback and suggestions for the feature in the Trailblazer Community.

7. Develop Event-Driven Apps with Pub/Sub API (Generally Available)

Publish and subscribe to platform events and change data capture events using Pub/Sub API, a secure, highly performant, and scalable API based on gRPC. Use one of the 11 supported programming languages, including Python, Java, Go, and Node. Get peace of mind with final publishing results instead of intermediate queueing results. And with subscription flow control, fine-tune the number of event messages that you receive based on your event processing speed.

Pub/Sub API uses protocol buffers as the Interface Definition Language (IDL) and as the underlying message interchange format. The Pub/Sub API service is defined in a proto file, with RPC method parameters and return types specified as protocol buffer messages. Within those protocol buffer messages, the payload of the published and delivered events is encoded in binary Apache Avro.

This proto file example is based on the Pub/Sub API proto file, but salesforce shortened it in this illustration. This proto file defines the service by listing the methods to publish, subscribe, get the schema, and get the topic information.

8. Filter Your Stream of Platform Events with Custom Channels (Generally Available)

Optimize event processing by receiving only the event messages that match a predefined filter on a custom channel. Create a channel and configure it with a filter expression for CometD clients. With fewer events delivered, subscribers can make more efficient use of the event delivery allocation.

(City__c LIKE 'S%' OR City__c = 'New York') 
  AND Delivery_Date__c > 2022-07-21T09:30:11-08:00
  AND Has_Shipped__c = TRUE
With this feature you can unload your system, please review this article to be familiar with platform event allocation.

To monitor your standard-volume event delivery usage, use the limits REST API resource, and inspect the DailyStandardVolumePlatformEvents value. And to monitor the publishing usage, inspect the HourlyPublishedStandardVolumePlatformEvents value.

9. Chart Your Apex Course with the Save Order of Execution Diagram

As you requested, here's a diagram to represent the save order of execution, which is the order that events are applied when you save a record in Salesforce. The diagram is available on the Salesforce Architects site and linked from Triggers and Order of Execution in the Apex Developer Guide.

10. Create Custom Address Fields (Generally Available)

To improve address data accuracy and your users’ experience, create custom fields that mimic the behavior of standard address fields.

11. Select Multiple Records in the Lookup Flow Screen Component

Now you can search and then select more than one record with the Lookup flow screen component. You can specify a selection maximum and one or more default records. Just add the Lookup component to your screen flow and set the Maximum Selections field to a value greater than 1.

Keep this in mind as action on

Changed Limits



Useful links:
Tagged under: Release Notes Winter'23

Comments powered by CComment