• Taylor Kingsbury

Winter '22 Developer Features




With the new release already upon us, we’d like to share some of our favorite features that are now available for developers. Here are a few of the standout items we noticed in the release notes that range from new packaging abilities to lightning input fields.


View Dependencies LWC

When working with Lighting Web Components, understanding the relationships between each of our components can be a challenge. When viewing the components from an editor, all components appear in a single file. Since components can be nested, there is often a need to view the hierarchy of how those components are working together.

So how can you tell which components are child components and which ones are parent components?


With the new Dependencies Tree, it’s possible to view all components in one place and view them within a tree hierarchy. There is also the ability to filter down to the components you are working with through search and sorting features.


For example, take a look below at myChildComponent and myParentComponent. Since they are both in the same folder, there’s no way to immediately tell what the component hierarchy looks like until you read the code.

myChildComponent



myParentComponent



However, with the dependency tree, we see the parent-child relationship of these components immediately:




Packages

There were a lot of features available for packages this release, so we thought we’d include our three favorites:


Remove Metadata Components from Second-Generation Managed Packages Beta

The ability to remove components from a package allows for more flexibility when deciding what metadata actually belongs in our second-generation packages. If a customer wishes to remove a class or trigger completely, the user can simply install an upgraded version with the class or trigger removed from the package. This eliminates the extra step of having to remove classes or triggers manually from the org after a package upgrade. In Winter ‘22, the list of the types of metadata components that can be removed has grown - see the full list here.


Simplify Package Development by Creating and Specifying an Org Shape

Often, when a scratch org is built, there are still features that need to be enabled in order to obtain parity with all of the features in the org. There may be a series of manual steps to either turn on individual features directly or go back and change the scratch definition file to include the missing features. Using org shapes with scratch orgs, it is possible to build new scratch orgs with close parity to the features enabled in production without having to hunt down what those features actually are one by one. With this Winter ‘22 enhancement, you'll be able to define the org shape, via the sourceOrg key within the scratch org definition file, that will be used during package creation to validate the metadata within your package.


View Your Progress During Package Uninstalls

With the ability to monitor the progress of the uninstallation of a package, we won’t have to simply wait for an email to determine if the uninstall was successful. We can watch the progress of the uninstall live as it’s happening in our org.



Invocable Actions in Apex

Call Invocable Actions from Apex (Developer Preview)

Invocable actions are useful when called from a flow, but what if we require the same functionality within code? The example below shows a Chatter Post action being called from within apex. It utilizes the current user’s id to post a message to their chatter feed.


To see it in action, we can run the following code in the developer console:


When you click back to your chatter tab, you will see that a Chatter post assigned to your own user has been created.



ENUM Conversion

Use the valueOf() Enum Method to Convert a Specified String to an Enum Constant Value

Previously, the valueOf operator on string caused an error, but now a developer has the ability to convert a string to its respective enumerated value. In the example below, Rating has been created as an enumerated type, and the string value of ‘low’ can be converted to an enum value.


Lightning input field: time

New and Changed Aura Components

Aura components are still relevant when updating legacy code, and updates to them are thankfully not ignored. From this release, inputField values now support the Time field type. One use case for this is on record edit forms, which provide the ability to update a record without creating any javascript or apex code to maintain. Below is an example of an Account record edit form with the Name and Time field added to the form.


The Winter release features a mix of enhancements to existing features as well as some exciting new features. This release has shown us that Salesforce is committed to providing new features with enhancements to Lightning Web Components and Second Generation packaging. The Winter ‘22 Release also highlights Apex enhancements for existing features as seen with enumerated classes and actions. At the same time, Salesforce continues to enhance its more legacy features such as Aura Components.


Recent Posts