Skip to main content

Salesforce Spring 21 Release for Developers. Major changes

About Us
Published by jetbi
05 May 2021
111

The Spring ’21 release brought a lot of valuable features to Salesforce. New features provide great solutions in enhancing business productivity and development. We have prepared an overview of the most interesting updates for Developers.

  1. 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 together 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. Available to organizations that enable the pilot feature.

  1. 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 may be 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.

The System.FinalizerContext interface contains four methods:

  • 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.

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. For more information on implementing Transaction Finalizers, including examples, see Transaction Finalizers (Beta) in Apex Developer Guide.

  1. Obtain a map containing all custom metadata records or a single record sObject for a custom metadata type

Use the new Apex getAll(), getInstance(recordId), getInstance(qualifiedApiName), or getInstance(developerName) methods to retrieve custom metadata type records. So no more SOQL query to fetch custom metadata records.

Map<String, Custom_Metadata__mdt> allRecords= Custom_Metadata__mdt.getAll();

The sample below returns a single record sObject for the custom metadata type named Custom_Metadata_mdt with record ID specified as m00000000000001.

Custom_Metadata__mdt md = Custom_Metadata__mdt.getInstance('m00000000000001');

  1. Convert an 18-character Id value to a 15-character case-sensitive string

Use the to15() method in the System.Id class. This method uses the case-sensitivity checksum in the 18-character Id value to fix any mangled casing and returns a 15-character case-sensitive string.

Example:

String Id_15_char = '0D5B000001DVM9t';

String Id_18_char = '0D5B000001DVM9tkAh';

ID testId = Id_18_char;

System.assertEquals(testId.to15(),Id_15_char);

  1. SOQL, select all fields

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

In general new features improved the usability of the development. Now it is not necessary to create lightning components for using LWC in Quick Action. Also simplified custom metadata selection, which allows you to develop applications faster with custom metadata. New features speed up application development.


Sahib Gadzhiev
Software Engineer
Question to the expert

We have available resources to start working on your project within 5 business days

1 UX Designer

1 Admin

2 QA engineers

1 Consultant

Related Articles
All articles
Salesforce
IoT
Native IT Service Management solution for Salesforce®
There are numerous ITSM options on the market, the most prominent of which are: Freshservice, ServiceNow, BMC Remedy, SolarWinds Service Desk, and so on. They are all outside of the Salesforce system, necessitate additional user training, and have the potential to complicate the business process. As a result, many Salesforce clients seek native ITSM Salesforce solutions to consolidate all processes on a single platform. This was a project for our group.
20 September 2022
7 reasons Why you should attend Dreamforce 2022
Have you ever wanted to be a part of a big community of like-minded people united by common goals, and values, passionate about learning new things, making friends, sharing experiences and simply having fun? We bet you have. That is what Dreamforce is about! We get that it may not be physically that easy to attend the event but it may be as hard to have enough spare time and motivation to watch it online. Here are 7 reasons why you should become a part of the biggest Salesforce event of the year.
20 September 2022
10 Effective ways to upsell Salesforce® to existing customers
When many companies look to increase their revenue, it's important to work with your most valuable potential market: your current customers. Given that acquiring a new customer costs 5 to 25 times more than retaining a current one, working on upselling and cross-selling is a much more profitable way to grow your business.
01 September 2022