Winter 19: Top Features

Winter 19 has a lot of new features released which provides more flexibility while creating apps in Salesforce. Here are some of my favourite features:

New component lightning:map
Before Winter 19 release, to display a map, you need to use external JS library like Leaflet. But with Winter 19, maps will be supported by the platform using lightning:map. This tag is similar to the apex:map tag available in Visualforce page.



New attribute in lightning:accordion
Before Winter 19 release, the default behaviour of accordion was that only one section can be opened at a time. If you want to open all the sections at once, it was not supported. The workaround was to use html accordion instead of lightning accrodion. But now with Winter 19, Salesforce has introduced a new attribute called allowMultipleSectionsOpen. If this attribute is set to true, then all the sections can be opened at the same time.

Mark Apex Method as Cacheable
As mentioned in my last blog, the current solution to implement client side caching is to use setStorable() on every JavaScript action that calls the Apex method. With Winter 19, you can mark an apex method as Cacheable. To cache data returned from an Apex method for any component with an API version of 44.0 or higher, annotate the Apex method with @AuraEnabled(cacheable=true). For example:
@AuraEnabled(cacheable=true)
public static Account getAccount(Id accountId) {
// your code here
}
To update an existing component to use an API version of 44.0, remove setStorable() calls in JavaScript code. Annotate the Apex method with @AuraEnabled(cacheable=true) instead of @AuraEnabled, or you’ll get an error response for the action.

Enable CDN to Load Lightning Experience Faster
Load Lightning Experience and other apps faster by enabling Akamai’s content delivery network (CDN) to serve the static content for Lightning Component framework. This setting is disabled by default for existing orgs and enabled by default for new orgs.
To enable CDN, from Setup, enter Session in the Quick Find box, and then select Session Settings. Select Enable Content Delivery Network (CDN) for Lightning Component framework, and click Save.

Geolocation support for lightning:inputField
The lightning:inputField component now supports the geolocation field type. It displays input fields for entering latitude and longitude in decimal degrees.

Add Attachments to Lightning Email Templates
Your company’s marketing collateral can now be part of your email templates. By adding attachments to email templates, sales reps don’t have to worry about remembering to include that key brochure when emailing customers. Plus, you can make sure that attachments always include the latest content. When editing an email template, click the Related tab, and upload the file.

Opt In to Fire Platform Events from Batch Apex Classes (Beta)
Batch Apex classes can now opt in to fire platform events when encountering an error or exception. Event records provide more granular tracking of errors than the Apex Jobs UI. You can get access to information like which records were in scope at the time of failure, and other exception details.  Events are also fired for Salesforce Platform internal errors and other “uncatchable” Apex exceptions like LimitExceptions that are caused by reaching governor limits.
To fire a platform event, a batch Apex class declaration must implement the Database.RaisesPlatformEvents interface.
public with sharing class YourSampleBatchJob implements Database.Batchable<SObject>,
Database.RaisesPlatformEvents{
// class implementation
}
Use Inherited Sharing to Secure Your Apex Code
Apex class without a sharing declaration is insecure by default. The sharing is inherited by the caller of the class. For example, if a trigger calls an Apex class and the class has no sharing declaration, then the class runs as without sharing because Trigger always runs in System mode.
You can now specify the inherited sharing keyword on an Apex class, which allows the class to run in the sharing mode of the class that called it. Using inherited sharing enables you to pass security review and ensure that your privileged Apex code is not used in unexpected or insecure ways.

How: This example declares an Apex class with inherited sharing and a Visualforce invocation of that Apex code. Because of the inherited sharing declaration, only contacts for which the running user has sharing access are displayed. If the declaration is omitted, even contacts that the user has no rights to view are displayed due to the insecure default behavior of omitting the declaration.
public inherited sharing class InheritedSharingClass{
    public List<Contact> getAllTheSecrets(){
        return [SELECT Name FROM Contact];
    }
}
<apex:page controller="InheritedSharingClass">
    <apex:repeat value="{!allTheSecrets}" var="record">
        {!record.Name}
    </apex:repeat>
</apex:page>
Visual Studio Code is now available for normal orgs(Beta)
Connect to any org to retrieve and deploy source from Visual Studio Code. Previously, you could use Salesforce Extensions for VS Code only with scratch orgs. Salesforce Extensions for VS Code is the flagship development environment for customizing Salesforce with code. The ability to connect to and develop against any org enables you to start using Visual Studio Code, even if you don’t work exclusively with scratch orgs.

Web to Lead: Reject Leads That Don’t Use reCAPTCHA
Stop spammers from sending you bogus leads. Reject leads that generate from Web-to-Lead that don’t use reCAPTCHA verification. In Setup, go to the Web-to-Lead Setup page, and look for the Require reCAPTCHA Verification setting. Enabling this setting turns on the Include reCAPTCHA in HTML setting on the Create a Web-to-Lead Form page. Then make sure that the HTML on your website includes the reCAPTCHA code.

Comments

Popular posts from this blog

Salesforce Hacks: System.LimitException: Too many queueable jobs added to the queue: 2

Salesforce Lightning: Countdown timer

Building an Org Role Hierarchy component in LWC