Developers / Releases

10 Coolest Salesforce Winter ’24 Features for Developers

By Andrew Cook

The enchanting Salesforce Winter ’24 release is on its way, much like snowfall on the horizon, and the gift of its release notes has arrived. This winter wonderland of a release is brimming with a flurry of delightful new features!

All the information you need to prepare for your instance’s upgrade can be found right here. But for now, let’s venture into the heart of this frosty wonderland and explore the most captivating features and updates – tailored for developers – in the Salesforce Winter ’24 release.

1. Transform Flow Element (Beta)

The new Transform element in Flow Builder allows for the seamless exchange of data collections between different Flow resources. When combined with the Action element for HTTP callouts, it enables the creation of a comprehensive flow that seamlessly integrates external data into Salesforce, all without requiring any coding. This replaces the need for previous methods that involved using the Loop and Assignment elements. 

The Transform element can now handle data transformation tasks across various Flow types, including screen flows, autolaunched flows without triggers, and record-triggered flows.

READ MORE: The Complete Guide to Salesforce Flow

The following is an example of how this can be used in a screen flow. The customer has a Salesforce account, but order data is in an external system. The flow retrieves the latest order data from the external system and transforms it to update the order record in Salesforce.

The Transform element maps fields like amount, customerId, and status from source data to target data. This mapping is shown with dotted lines connecting collections, making it easier to see connections. Source and target items must align in a hierarchical position. For instance, the 2XX and Order collections are initial ones. A formula transforms the source’s amount field to the target’s Amount__c field, deducting a restocking fee.

The Update Records element then saves changes in the database, and an Action element updates order status externally. Debugging the Transform element in autolaunched or record-triggered flows lets you interactively work with source and target data.

As this feature is in beta, please be aware of the following:

  • Source data lacks global variables.
  • Transform element works in autolaunched, screen, and triggered flows.
  • Packaging isn’t supported.
  • Primitive collection not supported.
  • Certain Choice Sets treated like strings.
  • Supports only one level of nested collections.
  • Read-only fields are hidden on the target side.
  • No traversals for sObjects.
  • UI shows only one input source.
  • Manual output mapping is not supported.
  • No built-in aggregation (count, sum, etc.).
  • No collection transformation (join, filter, etc.).
  • Maximum of 10 nested levels.

2. Migrate to Hyperforce With Hyperforce Assistant (Generally Available)

Utilize the Hyperforce Assistant for a seamless migration to Hyperforce. This assistant is now widely accessible for both production and sandbox orgs. Check out the revised Hyperforce region availability map on the Learn page. Moreover, enhancements have been made to the hard-coded references and connectivity checks in the Prepare phase, enhancing your overall migration experience.

You will receive an email from Salesforce when it is time for your org to migrate to Hyperforce. As Hyperforce is a new platform, Salesforce wants to make sure that it is stable and reliable before migrating everyone onto Hyperforce. Furthermore, some customers may not be ready to migrate to Hyperforce yet, for a variety of reasons such as custom code that is not compatible with Hyperforce.

3. Specify Custom Access Using Permission Sets for User Mode Database Operations (Developer Preview)

The new AccessLevel.withPermissionSetId() method enables database and search tasks with permissions from a designated permission set. It enforces field-level security and object permissions according to the specified permission set. This feature is accessible in scratch orgs with enabled ApexUserModeWithPermset. Without this enabled, the code can compile but not execute.

During the Developer Preview, the AccessLevel.withPermissionSetId() method can be utilized by providing a permission set ID. This method ensures that specific user mode DML operations respect the permissions of the specified permission set. In the past, DML operations could be run in user mode, adhering to the FLS and object permissions of the active user.

An example involves using AccessLevel.withPermissionSetId() to insert a custom object while utilizing the permissions from the designated permission set:

Code

@isTest
public with sharing class ElevateUserModeOperations_Test {
    @isTest
    static void objectCreatePermViaPermissionSet() {
        Profile p = [SELECT Id FROM Profile WHERE Name='Minimum Access - Salesforce'];
        User u = new User(Alias = 'standt', Email='standarduser@testorg.com',
            EmailEncodingKey='UTF-8', LastName='Testing', LanguageLocaleKey='en_US',
            LocaleSidKey='en_US', ProfileId = p.Id,
            TimeZoneSidKey='America/Los_Angeles',
            UserName='standarduser' + DateTime.now().getTime() + '@testorg.com');
        System.runAs(u) {
            try { 
                Database.insert(new Account(name='foo'), AccessLevel.User_mode); 
                Assert.fail(); 
            } catch (SecurityException ex) { 
                Assert.isTrue(ex.getMessage().contains('Account'));
            }
            //Get ID of previously created permission set named 'AllowCreateToAccount'
            Id permissionSetId = [Select Id from PermissionSet 
                where Name = 'AllowCreateToAccount' limit 1].Id;
            Database.insert(new Account(name='foo'), AccessLevel.User_mode.withPermissionSetId(permissionSetId)); 
            // The elevated access level in not persisted to subsequent operations
            try { 
                Database.insert(new Account(name='foo2'), AccessLevel.User_mode); 
                Assert.fail('permset leaked'); 
            } catch (SecurityException ex) { 
                Assert.isTrue(ex.getMessage().contains('Account')); 
            } 
            
        } 
    } 
}

Code end

As this feature is in Developer Preview (and not yet generally accessible unless Salesforce officially announces it), all aspects of the feature – including commands and parameters – might change or become deprecated without notice. It’s advised not to use this feature in a production environment. Feedback and suggestions for the “Permission Sets with User Mode” feature can be shared in the Trailblazer Community.

READ MORE: Salesforce Profile Permissions: The Danger Zone

4. Iterate Within For Loops More Easily with Iterable

You can now easily iterate through lists or sets using an Iterable variable in a for loop, meaning you have the capability to conveniently go through collections (like lists or sets) by using an Iterable variable within a for loop. In other words, you can efficiently access and process each element in the collection one by one using this approach.

Here is an example iterates through a list of strings:

Code

Iterable<String> stringIterator = new List<String>{'Hello', 'World!'};
   for (String str : stringIterator) {
      System.debug(str);
}

Code end

Here is an example implementing an Iterable interface which then iterates through the strings in the returned set of strings:

Code

public class MyIterable implements Iterable<String> {
   public Iterator<String> iterator() {
      return new Set<String>{'Hello', 'World!'}.iterator();
   }
}
for (String str : new MyIterable()) {
   System.debug(str);
}

Code end

5. Download Package Metadata for a Specific Package Version

Utilize the sf package version retrieve CLI command to download metadata from a certain package version to download metadata (configuration settings, code, etc.) associated with a specific version of a package. This package can be a managed package (either second- or first-generation) or an unlocked package.

When you use this command, you need to specify either the alias (a short name) of the package or the ID of the package version (which starts with “04t”). Additionally, you should provide the path to an empty directory on your computer. The metadata from the specified package version will be fetched and saved into the empty directory you specified.

6. Process Platform Events at Scale With Parallel Subscriptions for Apex Triggers (Pilot)

You can improve the speed at which platform events are handled in an Apex trigger by dealing with multiple event subscriptions at the same time, rather than just one at a time. The type of events each subscription handles is determined by the partition key you define. This partition key can be a custom field within the platform event or the standard “EventUuid” field.

Moreover, you have the ability to specify up to 10 partitions. These partitions represent parallel subscriptions that the trigger internally creates. This approach helps distribute the workload and process events concurrently, enhancing efficiency. It’s important to note that this parallel subscription feature is applicable to custom platform events, but not for standard events or change events.

READ MORE: Salesforce Apex Triggers 101 Course: Available Now

To configure parallel subscriptions for an Apex trigger, specify the event field used for partitioning (PartitionKey) and the number of partitions (NumPartitions) in PlatformEventSubscriberConfig using Tooling API or Metadata API. 

To monitor your parallel subscriptions, from Setup (in the Quick Find box), enter Platform Events, select Platform Events, and then click your platform event. The parallel subscriptions are displayed on the platform event detail page, in the Parallel Subscriptions related list.

7. Scan Documents With a Mobile Device Using Lightning Web Components

Now for a couple of mobile-specific updates coming in Winter ‘24. The first allows you to use the DocumentScanner API to access native device functionality to scan documents and parse their text content.

In today’s workforce, many people and companies are torn between using physical paper documents and completely digital ones. Have you ever been in a situation where you only had a paper copy of a document and wished you could have it in a digital format that you can edit? Well, now the solution is as simple as making an API call, especially for developers working with Lightning Web Components! With DocumentScanner, you can create components that allow you to scan documents and customize this functionality according to what your audience requires.

Using DocumentScanner in your LWC-enabled mobile app is easy:

  1. Import DocumentScanner into your component definition.
  2. Run tests to ensure DocumentScanner is available before calling document-scanning functions.
  3. Use the scan() function to scan a document and interact with the extracted text.
READ MORE: Mobile Offline Developer Guide

8. Access a Mobile Device’s Biometrics Capabilities With Lightning Web Components

Now for the second mobile-specific update. You can now use the BiometricsService API to utilize device features and prompt users to confirm their identity using biometrics.

App developers and users both prioritize security and privacy. Many iOS and Android users use biometrics to safeguard their sensitive information. Now, Lightning Web Components developers can integrate this feature into their components. With BiometricsService, you can create components that ask users to verify their identity using their device’s biometric features.

READ MORE: Your Guide to Lightning Web Components: Let’s Explore LWC

Using BiometricsService in your LWC-enabled mobile app is easy:

  1. Import BiometricsService into your component definition.
  2. Run tests to ensure BiometricsService is available before calling biometrics-related functions.
  3. Use the feature functions to prompt biometric identity confirmation.

9. Monitor Component Events With the Custom Component Instrumentation API (Beta)

If you have Salesforce Shield or Salesforce Event Monitoring add-on subscriptions, you can now enhance the visibility and monitoring of your Lightning Web Components (LWC) using the Custom Component Instrumentation API (in beta). This API allows you to actively observe and trace events or user interactions associated with your custom Lightning Web Components within your organization’s Event Monitoring.

Unlike before, when Event Monitoring tools only provided insights about your entire application, this new API enables you to specifically monitor the behavior of individual custom Lightning Web Components. It’s important to note that the Custom Component Instrumentation API is tailored for Lightning web components and does not work with Aura components.

Import log from the lightning/logger module in your component and log data messages to Event Monitoring. The log() function publishes data to a new EventLogFile event type called Lightning Logger Event that structures the event data for use in Event Monitoring.

Code

<!-- myComponent.html -->
<template>
  <lightning-button label="Approve" 
                    onclick={handleClick}>
  </lightning-button>
</template>
// myComponent.js
import { LightningElement } from 'lwc';
import { log } from 'lightning/logger';
export default class HelloWorld extends LightningElement {
  constructor() {
  super();
  }
  let msg = {
      type: "click",
      action: "Approve"
  }
  handleClick() {
    log(msg);
  }
}

Code end

10. View DataWeave Scripts in Setup UI

Currently, it isn’t straightforward to view DataWeave Scripts in Salesforce. You need either the Package Explorer, Apex Editor, or Dataweave Editor to access them. Thankfully, this is going to change in Winter ‘24 with the introduction of list views for DataWeave Scripts.

You will soon have the ability to generate a list view for DataWeave resources within your organization and examine DataWeave scripts that have been deployed under your namespace. Choose the specific fields you wish to track, including DataWeave Resource ID, Name, Namespace Prefix, and API Version. 

Summary

And there you have it – our overview of the most enchanting Salesforce Winter ’24 release features, tailored especially for developers. Have you come across any other cool new additions? Share your discoveries with us in the comments!

Read more:

The Author

Andrew Cook

Andrew is a Salesforce Technical Instructor at Salesforce Ben. He is 14x certified and has worked in the ecosystem for 12 years.

Leave a Reply