Top 5 Lightning Component Gems of  Salesforce Summer’19 Release!

Top 5 Lightning Component Gems of Salesforce Summer’19 Release!

Last Updated on June 24, 2020 by Rakesh Gupta

The Lightning Component modern framework is a User Interface framework to develop dynamic web apps for mobile and desktop devices. As is the case with each release, the latest Summer‘19 release is packed with rich features including, the newly added Lightning Component features!

Currently, Summer’19 release is available under the pre-release program. On the 3rd and 4th of May, Sandboxes have upgraded; as a result, your organization now get the look and feel of Summer’19 release.

In case you have not read the entire 472 pages of Salesforce Summer’19 release notes, check out Summer’19 release quick summary and the Summer into Top 10 Lightning Experience Gems of Salesforce Summer’19 Release! written by me. 

I combed through the release notes and highlighted the added capabilities to the Lightning Component features. Believe me, it was hard to stop at just five! To kick things off, here is my take on the coolest Lightning Component features from Summer’19 release. 

1) Enforce Field-Level Security in Apex (Pilot):- Apex has a new security feature for field-level data protection, which is accessed through the Security and SObjectAccessDecision classes. To ensure secure processing in Apex in the context of the current user’s read, create, or update operation, use the stripInaccessible method. Based on the field-level security of the current user, this method can be used to strip the fields from query results that the user can’t access. The method can also be used to remove inaccessible fields from sObjects before a DML operation to avoid exceptions and to sanitize sObjects that have been deserialized from an untrusted source.

For example, If the user doesn’t have the permission to create the Probability field of an Opportunity object, this example removes the Probability field before creating the records. The DML operation is completed without throwing an exception.

List opportunities = new List{
new Opportunity(Name='Opportunity1'),
new Opportunity(Name='Opportunity2', Probability=95)
};

// Strip fields that are not creatable
SObjectAccessDecision decision = Security.stripInaccessible(
AccessType.CREATABLE,
opportunities);

// Print stripped records
for (SObject strippedOpportunity : decision.getRecords()) {
System.debug(strippedOpportunity);
}

// print modified indexes
System.debug(decision.getModifiedIndexes());

// Print removed fields
System.debug(decision.getRemovedFields());

//System.debug Output
// DEBUG|Opportunity:{Name=Opportunity1}
// DEBUG|Opportunity:{Name=Opportunity2}
// DEBUG|{1}
// DEBUG|{Opportunity={Probability}}

2) Process Change Event Messages in Apex Triggers:- With Apex change event triggers, you can now process change event messages on the Lightning Platform. Change event triggers run asynchronously after the database transaction is completed. Perform resource-intensive business logic asynchronously in the change event trigger and keep transaction-based logic in the Apex object trigger. By decoupling the processing of changes, change event triggers can help reduce transaction processing time.

Each change event processed in the trigger contains the record fields and metadata information about the change in header fields.

A change event trigger is an “after-insert” trigger, defined with the after insert keyword. The trigger fires after the change event message is published. You create an after-insert trigger in the Developer Console the same way you create an Apex object trigger. When you create a trigger, pick the change event object from the sObject dropdown, which is populated with the change events available in your org. For a supported standard object, the change event name is StandardObjectNameChangeEvent. For a custom object, the change event name is CustomObjectName__ChangeEvent.

This trigger shows a simple change event trigger on AccountChangeEvent.

trigger MyAccountChangeTrigger on AccountChangeEvent (after insert) {
for (AccountChangeEvent event : Trigger.New) {
// Process event messages
}
}

3) Use Lightning Web Components in Visualforce Pages:- Add a Lightning web component to a Visualforce page to combine features that you’ve built using both technologies. Implement new functionality using Lightning web components and then use it with existing Visualforce pages.

Adding a Lightning web component to a Visualforce page is a three-step process.

  1. Add the Lightning Web Components for Visualforce JavaScript library to your Visualforce page using the component.
  2. Create and reference a standalone Aura app that declares your component dependencies.
  3. Write a JavaScript function that creates the component on the page using $Lightning.createComponent().

Use the naming convention to reference a Lightning web component in a Visualforce page.

4) Use Lightning Web Components in Standalone Aura Apps:- Adding a Lightning web component to a standalone Aura app is now supported.

The naming convention to reference a Lightning web component is, the same as the naming convention for using a Lightning web component in an Aura component.

This standalone Aura app uses the myComponent Lightning web component in the default c namespace.

 

<!-- sampleApp.app -->
<aura:application>
<c:myComponent />
</aura:application>

5) Make Long-Running Callouts with Continuations:- Use the Continuation class in Apex to make a long-running request to an external web service from an Aura component or a Lightning web component. Process the response in a callback method. An asynchronous callout made with a continuation doesn’t count toward the Apex limit of 10 synchronous requests that last longer than five seconds. Therefore, you can make more long-running callouts and integrate your component with a complex back-end API. Keep the following limits handy when using it: 

  • A single Continuation object can contain a maximum of three callouts.
  • Serial processing for continuation actions.
  • An Apex method that returns a Continuation object can’t perform Data Manipulation Language (DML) operations. DML statements insert, update, merge, delete, and restore data in Salesforce. If a DML operation is performed within the continuation method, the continuation execution doesn’t proceed, the transaction is rolled back, and an error is returned. You can perform DML operations in the Apex callback method for the continuation.

Additional enhancements worth noting!

1. Add Lightning Web Components to Apps with Lightning Out (Beta): – Use Lightning Out to run Lightning web components outside of Salesforce servers. Whether it’s a Node.js app running on Heroku or a department server inside the firewall, build your Lightning web components in a standalone Aura app. Then, run them wherever your users are. Lightning Out is already available for Aura components. This change offers equivalent functionality for Lightning web components.

2. Configure Your Component for Different Devices: – If your Lightning component is used on a Lightning page, you can declare which form factors your component supports: desktop, phone, or both. For example, on an app page—which supports both desktop and phone—you can now configure a component to only render when that app page is viewed on a particular device. If you restrict form factor support for your component to phone only, the app page drops the component when the page is viewed on a desktop and displays it when the page is viewed on a phone

What are your favorite Summer’19 release note gems? 

–> You can download release notes in HTML format!, for PDF file.

Note: – I am grateful to Resco.net, Smartcloud.io, and Taveza for sponsoring my blog.

Have feedback, suggestions for posts, or need more information about Salesforce online training offered by me? Say hello, and leave a message!

4 thoughts on “Top 5 Lightning Component Gems of Salesforce Summer’19 Release!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.