Spring'21 Release Notes

Published in Release Notes

The Sandbox Preview window for Spring ‘21 begins on January 8, 2021. If you would like your sandbox to take part, it must be active on a preview instance before then.

1. Flag Invocable Apex Methods That Make Callouts (Screen Flow only)

Previously, Salesforce recommended adding a local action or a screen element between your callout and any data operations, but that’s no longer necessary. For invocable actions that perform callouts, you can now add a callout attribute to the invocable Apex method annotation. With this information, a flow calling the action knows how to manage the transaction at run time. If the action is executed by a flow, at run time the flow determines how to successfully execute the action, in a new transaction or in the currently running transaction.

@InvocableMethod(callout=true label="My Action Label")

2. Configure the User and Batch Size for Your Platform Event Trigger

You can override the default running user and batch size of a platform event Apex trigger. By default, the trigger runs as the Automated Process system user with a batch size of 2,000 event messages. Configuring the user and batch size enables you to bypass some limitations that sometimes arise from using the defaults. For example, record system and OwnerId fields are populated as the specified user. And setting a batch size smaller than 2,000 can help avoid hitting Apex governor limits.

This example shows the configuration of OrderEventTrigger using Metadata API. The user is set to This email address is being protected from spambots. You need JavaScript enabled to view it. and the batch size is 200.

<?xml version="1.0" encoding="UTF-8"?>
<PlatformEventSubscriberConfig xmlns="http://soap.sforce.com/2006/04/metadata">
    <platformEventConsumer>OrderEventTrigger</platformEventConsumer>
    <batchSize>200</batchSize>
    <masterLabel>OrderEventTriggerConfig</masterLabel>
    <user>This email address is being protected from spambots. You need JavaScript enabled to view it.</user>
    <isProtected>false</isProtected>
</PlatformEventSubscriberConfig>

3. Access Custom Metadata Type Records Using Static Methods

Use the Apex getAll(), getInstance(recordId), getInstance(qualifiedApiName), and getInstance(developerName) methods to retrieve information from custom metadata type records faster. These methods don’t rely on the SOQL engine and return the sObject details directly from the call.

List<Games__mdt> mcs = Games__mdt.getAll().values();
Boolean textField = null;
if (mcs[0].GameType__c == 'PC') {
   textField = true;
}
System.assertEquals(textField, true);

4. The new FIELDS() function in SOQL

Salesforce Object Query Language now makes it easy to include pre-defined groupings of fields within a query statement using the new FIELDS() function. Use FIELDS(ALL), FIELDS(STANDARD), or FIELDS(CUSTOM) in your SELECT statements.

5. Use BatchApexErrorEvent Triggers to Monitor ISV Applications

Include BatchApexErrorEvent triggers in your managed package to monitor the health of batch jobs and take necessary corrective action without any post-installation steps. To fire this platform event, a batch Apex class declaration must implement the Database.RaisesPlatformEvents interface. A BatchApexErrorEvent platform event is fired when a batch Apex job encounters an unhandled exception.

6. Attach Actions to Asynchronous Apex Jobs Using Transaction Finalizers (Beta)

With Spring ’21, the Transaction Finalizers feature is in beta. A new limit establishes that a Queueable job that failed due to an unhandled exception can only be successively re-enqueued five times by a Transaction Finalizer. This limit applies to a series of consecutive Queueable job failures. The counter is reset when the Queueable job completes without an unhandled exception. Finalizers can be implemented as an inner class. Also, you can implement both Queueable and Finalizer interfaces with the same class.

To attach actions to your Queueable jobs, you must implement the FinalizerContext interface. Only one finalizer instance can be attached to any Queueable job. You can enqueue a single asynchronous Apex job (Queueable, future, or batch) in the finalizer’s implementation of the execute method. Callouts are allowed in finalizer implementations.

The System.FinalizerContext interface contains four methods.
public class SampleQueueable implements Queueable, Finalizer {
  private Integer enqueueRetryCount;
 
  public SampleQueueable() {
    enqueueRetryCount = 0;
  }
 
  public void execute(QueueableContext ctx) {
    System.attachFinalizer(this);
 
    // do some work here
    
    // throw exception to see retry logic (in finalizer) in action
    System.assert(false, 'Deliberate Exception Message');
  }
   
  public void execute(FinalizerContext ctx) {
    switch on ctx.getResult() {
      when SUCCESS {
        // Parent Queuable completed successfully
      }
      when else {
        enqueueRetryCount++;
        
        if (enqueueRetryCount <= 3) {
          System.enqueueJob(this);
        }
      }
    }
  }
}

Beta feature

Close

As a beta feature, Transaction Finalizers is a preview and isn’t part of the “Services” under your master subscription agreement with Salesforce. Use this feature at your sole discretion, and make your purchase decisions only on the basis of generally available products and features. Salesforce doesn’t guarantee general availability of this feature within any particular time frame or at all, and we can discontinue it at any time. This feature is for evaluation purposes only, not for production use. 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. All restrictions, Salesforce reservation of rights, obligations concerning the Services, and terms for related Non-Salesforce Applications and Content apply equally to your use of this feature. You can provide feedback and suggestions for this feature in the TransactionFinalizers group in the Trailblazer Community.

7. Create a Lightning Web Component Action (Pilot)

Create a Lightning web component (LWC) and use it as a quick action. Lightning web component actions work side by side on your pages along with Lightning component and Visualforce actions. LWC actions offer advantages such as the ability to easily customize headers and footers, and to create actions that have no UI representation.

8. Get Report Details Emailed in .xlsx Format (Lightning Experience only)

Get report exports in the format you want. When exporting a report, you can select .xlsx, .xls, or .csv as the format. Previously only .xls and .csv were supported. If security is a concern, you can hide the .xls option by selecting Hide the option to export a report in XLS format in Lightning Experience in Reports and Dashboards Settings.

9. Share Records with Manual Sharing

With manual sharing in Lightning Experience, you now can share records and manage record shares in a new streamlined interface. Previously, you switched to Salesforce Classic to give specific users and user groups access to records.

10. Convert Leads to a Person Account and a Business Account at the Same Time with the API

If your customers include individuals and groups, your sales teams can associate converted leads with a person account and a business account simultaneously. For example, a bank can create person accounts for each member of a family and group the family into a business account. To enable these lead conversions, build a custom flow with the API.

For Salesforce orgs that use APEX Lead Convert, Person Accounts, and Contacts to Multiple Accounts, new arguments are available on the LeadConvert() class. Use the new relatedPersonAccountId argument to convert the lead to an existing person account instead of a contact. Use the relatedPersonAccountRecord argument to convert the lead to a new person account instead of a contact.

The LeadConvert class includes new methods for setting and inspecting the related person account. The LeadConvertResult class has a new method and property.

11. Salesforce Functions: Extend Salesforce with Functions (Beta)

Salesforce Functions lets developer extend Salesforce with custom, elastically scalable business logic built with high-productivity programming languages and open-source components. Salesforce Functions reduces your infrastructure responsibilities, enabling you to build and integrate Functions-as-a-Service (FaaS) apps using the languages and tools of your choice. Write JavaScript or TypeScript code that uses the Salesforce Functions Node SDK to communicate with your org. Deploy your Function in the Salesforce Functions compute cloud with the Salesforce CLI. Then, invoke your Function using Apex, and the Salesforce Functions infrastructure authenticates and runs your Function on demand.

Beta feature

Close

As a beta feature, Salesforce Functions is a preview and isn't part of the “Services” under your master subscription agreement with Salesforce. Use this feature at your sole discretion, and make your purchase decisions only on the basis of generally available products and features. Salesforce doesn't guarantee general availability of this feature within any particular time frame or at all, and we can discontinue it at any time. This feature is for evaluation purposes only, not for production use. 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. All restrictions, Salesforce reservation of rights, obligations concerning the Services, and terms for related Non-Salesforce Applications and Content apply equally to your use of this feature. You can provide feedback and suggestions for Salesforce Functions in the Salesforce Functions Trailblazer Community. For information on enabling this feature in your org, contact Salesforce.

12. Debug Failed Flows More Easily

No more scrolling through a long flow error email to figure out what went wrong during the run. Now you can simply click a link in the error email to open Flow Builder and see the failed flow interview’s path on the canvas. The detailed error information appears next to the canvas.

In a flow error email, click Flow Error: Click here to debug the error in Flow Builder.

13. Query Cursors Optimized for Improved Performance

Apex optimized the way it uses query cursors. In cases such as SOQL queries that use a for loop, Apex no longer generates or uses query cursors internally. Instead, records are buffered in memory for improved performance and reduced query cursor contention. This optimization doesn’t apply to Batch Apex queries.

14. Ant Migration Tool Requires Java Version 11 or Later

The Sping ’21 Ant Migration Tool (version 51.0) and later requires Java version 11 or later. Earlier Ant Migration Tool versions continue to support Java version 7 or later.

15. Hello Experience Cloud, Farewell Community Cloud

To better reflect the many types of connected digital experiences you can create—including portals, websites, help centers, forums, and mobile apps—Community Cloud is now called Experience Cloud.

If you accidentally enter Community in the Quick Find box, Salesforce automatically display the renamed Digital Experiences menu instead. #Salesforce Thank you for that!

Keep this in mind as action on

Changed Limits



Useful links:
Tagged under: Release Notes Spring'21

Comments powered by CComment