Spring'19 is here! - Development

Salesforce Jan 15, 2019

This another post highlights features released changed specifically for development and deployment.

Development

Lightning Web Components (Generally Available)

Lightning web components are custom HTML elements built using HTML and modern JavaScript. Lightning Web Components brings the latest advancements in JavaScript and web standards to the Lightning Component framework.

Lightning Web Components uses core Web Components standards and provides only what’s necessary to perform well in all browsers supported by Salesforce. Because it’s built on code that runs natively in browsers, the Lightning Web Components programming model is lightweight and delivers exceptional performance. Most of the code you write is standard JavaScript and HTML.

Example:

Let’s look at some code. Each Lightning web component is made up of an HTML template and a JavaScript class. This component contains a base component, which is built on Lightning Data Service. The component attributes are object-api-name, record-id, and fields.

Html

<!-- recordFormDynamicContact -->
<template>
    <lightning-card title="RecordFormDynamicContact" icon-name="standard:contact">
        <div class="slds-m-around_medium">
            <lightning-record-form object-api-name={objectApiName}
                                   record-id={recordId} 
                                   fields={fields}>
            </lightning-record-form>
        </div>
    </lightning-card>
</template>

Javascript class

// recordFormDynamicContact.js
import { LightningElement, api } from 'lwc';
export default class RecordFormDynamicContact extends LightningElement {
    @api recordId;
    @api objectApiName;
    fields = ['Name', 'Title', 'Phone', 'Email'];
}

Output:

Locker Service is Now Lightning Locker

New Date-Time $Locale Attributes

The $Locale global value provider has new attributes for date-time formatting. $Locale returns information about the current user’s preferred locale.

Attribute Description Sample Output
longDateFormat Long date format. "MMMM d, yyyy"
shortDateFormat Short date format. "M/d/yyyy"
shortDatetimeFormat Short date time format. "M/d/yyyy h:mm a"
shortTimeFormat Short time format. "h:mm a"

The navigation service uses a PageReference object to describe pages. A new PageReference type of standard__webPage wraps a raw URL so that you can navigate to external websites.

The standard__webPage type replaces the force:navigateToURL event.

Allow External iframes of Visualforce Pages with Clickjack Protection

Use iframes to include Visualforce pages on external web pages while enabling clickjack protection. Whitelist the external domains that you trust to bring your Visualforce content outside the Salesforce domain. Previously, it was all or nothing: You could allow iframes of Visualforce pages on all external domains or none at all.

Under Clickjack Protection, select Enable clickjack protection for customer Visualforce pages either with headers disabled or with standard headers. Both these options allow framing on whitelisted external domains and provide clickjack protection. Then under Whitelisted Domains for Visualforce Inline Frames, add the trusted external domains where you allow framing.

Apex

Enforce Field-Level Security Permissions for SOQL Queries (Beta)

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.

Example

If field-level security for Website is hidden, this query throws an exception indicating insufficient permissions.

SELECT Id, Parent.Name, Parent.Website FROM Account WITH SECURITY_ENFORCED

Fewer Round-Trips for the FlexiPage Object by Using SObject Collections

Using Tooling API, you now can take action on multiple records belonging to the FlexiPage object with a single request. By grouping operations by object type, you reduce the number of round-trips between the client and server. SObject Collections supports XML and JSON formats. Only the FlexiPage object is supported.

Use a GET request to retrieve one or more records of the same object type, specified by ID.

/vXX.X/tooling/composite/sobjects/sobjectType?ids=recordId1,recordId2&fields=fieldname1,fieldname2

Use a DELETE request to delete to up 200 records, specified by ID, returning a list of DeleteResult objects.

/vXX.X/tooling/composite/sobjects/?ids=recordId1,recordId2

Save Time by Cloning Sandboxes (Generally Available)

Sandbox cloning simplifies the management of multiple concurrent work streams in your application life cycle. Clone an existing sandbox for each type of work, such as development, testing, and staging. As you move from one development stage to the next, clone an existing sandbox rather than using your production org as the source. This pattern simplifies the customization of individual sandboxes. Your colleagues can easily clone individual sandboxes instead of sharing one sandbox to avoid stepping on each other’s toes.

Deployment

Clone, Deploy, Upload, and Validate Change Sets with Fewer Clicks

You no longer have to load the change set’s detail page to initiate these operations. We added links to the Inbound Change Set page that you can use to initiate validation and deployment operations for both deployed and undeployed change sets. If the change set has been deleted from its source org, these operation links aren’t available. If a deployment of the change set is in progress, these operation links aren’t available until after the deployment completes. We also added links to the Outbound Change Set page that you can use to upload or clone change sets. If the change set doesn’t contain any components, the Upload link isn’t available.

Related Tags:

Salesforce   Apex   Component   Deployment   Development   Lightning   Spring'19