Blog Banner

What's new in the SF Summer'22 release for developers?

Here are the details one needs to know about the SF Summer’22 release for the developers. Salesforce has introduced some new and exciting features which will be helpful for the developers to boost productivity and solve complex problems. This blog will drive you through some of the important and interesting newly added features of Apex, Lightning, Visualforce, API, and many more development-related topics of salesforce.

Lightning Components

Enable Third-Party Integrations with Light DOM

By default, the lightning web component renders in shadow DOM and it provides strong encapsulation but possesses challenges for global styling and many third-party party integrations. By using the light DOM, your lightning web component markup will attach directly to the host element instead of the shadow tree that one can then access like any other content in the document host.

For achieving this, In <template> of Lightning Web Component use lwc:render-mode = ‘light’

Blog

Relaxed Save-Time Validation Rules for Aura Components

On the Save of aura component, some general JavaScript validation rules are removed. The validation rules are still available in the Aura plugin for ESLint. Validating using ESLint and saving aura components code will be done separately.

 

Use a Session Token for Lightning Apps on Third-Party Sites

When a Lightning app is in a third-party context, use the new setting, that replaces the authentication cookie with a session token.

Follow the steps below to implement the setting.

In Setup’s Quick Find box, enter "Session", and then select Session Settings. On the displayed page, select "When embedding a Lightning application in a third-party site", In the place of a session cookie using a session token.

 

New Alert, Confirm, and Prompt Modules help you create notifications.

Browsers like Chrome and Safari plan to end support for cross-origin use of window.alert(), window.confirm(), and window.prompt() native APIs. Instead of those, one can use the new modules LightningAlert, LightningConfirm, and LightningPrompt.

Html file

Blog

JS file

Blog Blog

Load Large Datatables Faster with Virtual Rendering

Display the data tables with more than 200 rows more quickly and make them scroll more smoothly with virtual rendering.

One needs to create a renderConfig object with the attribute virtualize set to vertical on the js file of a component.

Blog

Now on the HTML file set the render-config attribute to your renderConfig object on lightning data table. Also, Set the component’s render-mode attribute to role-based.

Blog

With Lightning Web Security, you can easily debug and run your code.

Previously it was difficult to search for problems in code but now one will have greater visibility into their code as it runs in a JavaScript sandbox.

Enable debug mode for the user to reflect this on the browser.

 

Disable Pull-to-Refresh in Mobile Components      

One can disable pull-to-Refresh to avoid the loss of code accidentally by refreshing the page. One can disable pull-to-refresh on Lightning web components and Aura components. It can be disabled by firing a CustomEvent in JavaScript.

 

Apex

In User Mode, Secure Apex Code for Database Operations

Instead of default system mode, the new database method supports an Access Level parameter which lets the users to run the operations in user mode.

Example of DML methods and Database.query: -

Blog Blog

For Apex Controller Methods, select Global Cache Scope.

The @AuraEnabled annotation is enhanced with a scope attribute for apex. By setting the scope to global enables Apex methods to be cached in a  global cache such as the Salesforce CDN.

Blog

Call Invocable Actions from Apex

“Invocable.Action” is a new Apex class that allows one to use Apex code to invoke the invocable actions. This feature is only accessible in scratch orgs for the developer preview.

To use this feature, one needs to add a reference to “CallIAFromApex” in the project-scratch-def.json file in your SFDX project.

Blog

Below is an example of how one can invoke the action.

Blog

Visualforce

 

Use Visualforce Pages to implement your Content Security Policy (CSP).

Allow Visualforce pages to make requests only to trusted external websites for the security of users and network. The CSP Trusted Sites list is already used for this purpose by Experience Cloud sites and Lightning Experience pages. One can now manage the sites on which they trust for their custom Visualforce pages using the same list. One can now add the site on the CSP Trusted Sites Setup page with a context of Visualforce pages as well.

 

With a Cross-Origin Opener Policy, you can keep your Visualforce pages safe.

To protect Visualforce pages from external threats. Each top-level custom Visualforce page opens in a different browsing context group when COOP is enabled. This process blocks direct access to one’s Visualforce page and its content from other browser tabs.

To preserve the access of necessary content, Salesforce recommends one should review the expected behavior and test COOP in sandbox before enabling this in production.

 

Validate Getter and Setter Access Modifier Enforcement During Visualforce Expression Language Parsing

This update improves the security by validating the Apex get or set method access modifier and will throw an error if the Visualforce Expression Language fails to call the method. On the custom controllers the Visualforce Expression Language does not validate getter and setter modifiers correctly. So, developers sometimes access unauthorized get and set methods. Now in this update Salesforce pre-validates the getter setter methods to improve security.

 

Prevent Consecutive API Navigation Calls

API navigation calls can be fired in a sequence in Visualforce pages and Lightning components, which might cause undesirable behavior owing to conflicting API calls. This release update eliminates the pattern of API navigation calls and just fires the initial navigation call. This release upgrade was only applied to Visualforce pages when it first became available. It is now also applied to Lightning components, as of Spring '22.

To prevent this, activate “Prevent Consecutive API Navigation Calls in Visualforce Pages”.

 

API

 

The Platform now includes a new error code as 410: GONE.

The 410: GONE new error code is introduced in this release. This error is returned when someone uses platform API such as Rest API with an operation or resource that has been removed.

Legacy API Versions 7.0 Through 20.0 Are Now Retired

Bulk API: 16.0, 17.0, 18.0, 19.0, 20.0

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

 

Legacy API Versions 21.0 Through 30.0 Are Now Deprecated

Bulk API: 21.0, 22.0, 23.0, 24.0, 25.0, 26.0, 27.0, 28.0, 29.0, 30.0

SOAP API: 21.0, 22.0, 23.0, 24.0, 25.0, 26.0, 27.0, 28.0, 29.0, 30.0

REST API: 21.0, 22.0, 23.0, 24.0, 25.0, 26.0, 27.0, 28.0, 29.0, 30.0

 

Packaging

 

Determine which Apex classes are underserved in terms of code coverage.

In this release, Salesforce expanded the output of the Salesforce CLI package version report command, to assist one figure out how to enhance code coverage for their packages. Salesforce provides a list of Apex classes that don't pass code coverage criteria after running the below commands from lowest to highest code coverage %.

To see the reports on Salesforce CLI, run this command

Blog

To create a JSON Report, run this command

Blog

Platform Events

In Apex, get the result of publishing asynchronous platform events.

“EventBus.EventPublishCallback” interface can be used to perform the operations after publishing the asynchronous platform event. Event Publish Callback has two methods, onSuccess, and onFailure. According to the success and failure results, these methods will get invoked and one can do further processing according to the result. See the code snippet below for reference.

Blog

I hope you have found the content of this blog interesting and useful. We have seen that the security of VF pages is enhanced in this release. Also, one of the cool features introduced for Apex is that one can now use the USER_MODE instead of the default System mode to ensure the FLS irrespective of sharing keyword on class.

For more release updates visit https://help.salesforce.com/s/articleView?id=release-notes.rn_forcecom_development.htm&type=5&release=238.

“Happy Coding”.

Recent Blogs

Blog Image

Mastering Data Preparation with Salesforce CRM Analytics Recipes

Read More
Blog Image

Rootstock Order Management

Read More
Blog Image

Strategies for Effective Data Analytics and Visualization in Decision Making

Read More
Blog Image

Enhancing E-commerce Experiences through Advanced Cloud Solutions

Read More
Blog Image

Leveraging Oracle NetSuite for Scalable and Integrated Business Management

Read More
Blog Image

The Future of Business with AI and Machine Learning in CRM Solutions

Read More
Blog Image

Innovations in Salesforce Implementation through Maximizing Customer Engagement and Operational Efficiency

Read More
Blog Image

Different Types of Power Apps

Read More