Skip to main content

Posts

Showing posts from 2019

WITH SECURITY_ENFORCED - Spring '19

Use the  WITH SECURITY_ENFORCED  clause to enable checking for field- and object-level security permissions on SOQL  SELECT queries, including subqueries and cross-object relationships. Although performing these checks was possible in earlier releases, this clause substantially reduces the verbosity and technical complexity in query operations. This feature is tailored to Apex developers who have minimal development experience with security and to applications where graceful degradation on permissions errors isn’t required. To use, just add the  WITH SECURITY_ENFORCED  clause in SOQL  SELECT  queries. If there are any fields or objects referenced in the  SELECT  clause that are inaccessible to the user, an exception is thrown and no data is returned. If field-level security for either the  LastName  or  Description  field is hidden, this query throws an exception indicating insufficient permissions. SELECT Id, (SELECT LastName FROM Contacts),    (SELECT Description FROM Oppor

Asynchronous Apex Triggers - Summer ‘19

Asynchronous Apex triggers are change event triggers that run asynchronously after a database transaction is completed. They are ‘after-insert’ triggers and can be defined with the  after insert  keywords. They can be created the same way you create regular Apex triggers. You set the trigger to use a change event object instead of an sObject. The change event object na me is suffixed with  ChangeEvent . For example, Account change event object is named  AccountChangeEvent . The change event object name for the custom object is suffixed with  __ChangeEvent . How does it work? When a record is created or updated, Change Data Capture publishes an event and a change event trigger can then process that event asynchronously. Let’s look at an example transaction. Whenever an opportunity record is created or updated, you need to check whether the corresponding account is qualified to be a high priority customer. This process of qualifying high priority customers is very limit-intensiv

New Lightning Components - Winter19

lightning:empApi Embed the  lightning:empApi  component in your custom Lightning component to subscribe to a streaming event channel and receive event notifications. You can subscribe to any type of event channel on the Lightning Platform, including channels for platform events, PushTopic and generic events, and Change Data Capture (Developer Preview) events. The  lightning:empApi  component uses a shared CometD-based Streaming API connection, enabling you to run multiple streaming apps in the browser. lightning:map The  lightning:map  component securely displays a map of one or more locations using Google Maps. You can pass markers to the component to define the locations to map. A marker can be a coordinate pair of latitude and longitude, or a set of address elements: City, Country, PostalCode, State, and Street. Here’s the map component with one address. When you specify multiple locations, the map component creates clickable tiles for each location. You can specify

Apex Inherited Sharing - Winter19

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. An Apex class with  inherited sharing  runs as with sharing when used as a Visualforce page controller, Apex REST service, or an entry point to an Apex transaction. Apex without a sharing declaration is insecure by default. Designing Apex classes that can run in either  with sharing  or  without sharing  mode at runtime is an advanced technique and can be difficult to distinguish from one where a specific sharing declaration is accidentally omitted. An explicit  inherited sharing  declaration makes the intent clear, avoiding ambiguity arising from an omitted declaration or false positives from security analysis tooling. There is a distinct difference between an Apex class that is marked wi