Spring'21 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>
Also, you can use Tooling API to create the PlatformEventSubscriber record. The easiest way to accomplish it is the REST Explorer feature from Workbanch.
To add a configuration, perform a POST request to this endpoint.
/services/data/v51.0/tooling/sobjects/PlatformEventSubscriberConfigProvide the values in the request body. This example request configures an existing trigger with the batch size of 200 and specifies the ID of a running user.
{ "BatchSize": "200", "DeveloperName":"OrderEventTriggerConfig", "MasterLabel":"OrderEventTriggerConfig", "PlatformEventConsumerId": "01qRM0000004PEhYAM", <-- Apex Trigger ID "UserId": "005RM00000231cZYAQ" <-- User ID }

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.
-
FIELDS(ALL) and FIELDS(CUSTOM) is not avaialble in Apex or Bulk API 2.0 but can be used in CLI, SOAP API and REST API. Please keep in mind that it supported only if the result rows are limited up to 200 records
SELECT FIELDS(ALL) FROM Account LIMIT 200
-
FIELDS(STANDARD) is available in Apex, Bulk API 2.0, SOAP API and REST API
SELECT FIELDS(Standard) FROM Account
-
You can mix FIELDS() with other field names in the field list
SELECT Id, Name, FIELDS(CUSTOM) FROM Account LIMIT 200
-
The API returns an error if the SELECT statement results in any duplicated field names
SELECT Id, FIELDS(ALL) FROM User LIMIT 200
HTTP/1.1 400 Bad Request [ { "message" : "duplicate field selected: Id", "errorCode" : "INVALID_FIELD" } ]
-
FIELDS() can also be used in subqueries
SELECT Account.Name, (SELECT FIELDS(ALL) FROM Account.Contacts LIMIT 200) FROM Account
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.
- getAsyncApexJobId method: Returns the ID of the Queueable job for which this finalizer is defined.
- getRequestId method: Returns the request ID shared by both the finalizer execution and the Queueable job to which the finalizer is attached. This shared ID helps in filtering logs of a Queueable job and its attached finalizer.
- getResult method: Returns the System.ParentJobResult enum, which represents the result of the parent asynchronous Apex Queueable job to which the finalizer is attached. Valid values for the enum are SUCCESS, and UNHANDLED_EXCEPTION.
- getException method: Returns the exception with which the Queueable job failed when getResult is UNHANDLED_EXCEPTION, null otherwise.
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
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.
- Experience Cloud sites and the Salesforce mobile app don’t support manual sharing in Lightning.
- Apex managed shares aren’t editable.
- Admins can’t modify the share access of record owners.
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
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
-
Advance Notice of Upcoming Retirement of Platform API Legacy Versions
With the Summer '21 release, legacy versions of the Salesforce Platform API will be retired and will no longer be supported by Salesforce. Customers can continue to use these legacy API versions until Summer ’21 is released, at which time these legacy versions will become unavailable. When these legacy versions are retired, applications consuming these of the APIs will experience disruption. The requests will fail with an error message indicating that the requested endpoint has been deactivated.
-
The following API versions will be retired and will no longer be supported by Salesforce:
- SOAP API
- 7.0, 8.0, 9.0, 10.0, 11.0, 11.1, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0
- REST API
- 20.0
- Bulk API
- 16.0, 17.0, 18.0, 19.0, 20.0
Changed Limits
-
Get More Characters for Field-Level Help Text
Customers can view the field-level help text by hovering over the Info icon. And with the character limit expanded from 255 to 510, you can now provide more detailed help information. This increase applies to standard and custom fields on detail and edit pages. -
Easily Integrate Larger Access and Refresh Tokens for OpenID Connect
The limit for access and refresh tokens is increased to 10,000 characters, which means you can now choose from more third-party identity providers to configure for Salesforce. Previously, the limit was 2,000 characters for each access token and 1,024 characters for each refresh token. -
Detect More Text with Einstein OCR
Einstein OCR (optical character recognition) now supports documents in PDF format (beta) in addition to graphic image formats. The maximum size of an image or PDF file that you can send to the optical character recognition (OCR) model increased from 5 MB to 10 MB. -
Create More Roles
In Salesforce orgs created in Spring ’21 or later, you can create up to 5,000 roles. In existing orgs, the default limit hasn’t changed. You can create up to 500 roles and can contact Salesforce Customer Support to increase this limit. Keep in mind that to improve performance, it’s best to set up roles based on data access and eliminate any roles that aren’t needed.
Useful links:
Comments powered by CComment