Blog

The hottest Salesforce Summer'23 Features For Developers

2023-07-11 14:10
Part 1
This part of the article is prepared by our developer Alexey Kashirskiy.

1. You Can No Longer Create New Process Builders

Probably the most expected thing in current Release is Process Builder retirement. To take the next step toward retiring Process Builder processes, you can no longer create new processes.

You can still activate, deactivate, and edit your existing Process Builder processes and continue to create automations in Flow Builder.

To test and create processes for use in managed packages, developer orgs still allow you to create processes.

Most Process Builder use cases are now supported in and work better in Flow. To facilitate migrating your processes, use the Migrate to Flow tool.


2. Implement Iterable on Set in Apex

The Set class now implements the Iterable interface, so you can directly iterate over sets.

Both sets and lists are iterable, allowing for more code reuse.

How: This example uses the String.join method with a Set, which was previously unsupported because Set didn’t implement Iterable.

Set<String> letters = new Set<String>{'a','b','c','d'};

System.debug(String.join(letters, '...'));


3. Configure Stack Depth of Chained Queueable Jobs

You can now set a maximum stack depth of Queueable jobs, overriding the default limit of five in Developer and Trial Edition orgs.

This feature also provides a larger safety mechanism to prevent run-away recursive jobs from consuming the daily Async Apex limit.

Enqueue jobs by using the new System.enqueueJob() overload. The method overload has an optional AsyncObjects parameter where you can specify the maximum stack depth and the minimum queue delay.

Use these methods in the new System.AsyncInfo class to determine the current and maximum stack depths and to get the minimum queueable delay.
getCurrentQueueableStackDepth()
getMaximumQueueableStackDepth()
getMinimumQueueableDelayInMinutes()
hasMaxStackDepth()


4. Async SOQL Retirement

Async SOQL is a method for running SOQL queries when you can’t wait for immediate results.

These queries are run in the background over Salesforce big object data.

Async SOQL provides a convenient way to query large amounts of data stored in Salesforce. It is implemented as a RESTful API that enables you to run queries in the familiar syntax of SOQL. Because of its asynchronous operation, you can subset, join, and create more complex queries and not be subject to timeout limits.

This feature is being retired in the Summer ‘23 release.

If you are using Async SOQL queries, you will need to replace them with bulk API and batch Apex.


Part 2
This part of the article is prepared by our developer Lizaveta Vasilyeva.

1. Access Labels in Apex Dynamically

Previously custom labels could be referenced in apex code in only one way:

System.Label.labelName;

The value was returned in language for the current user's language or if specified, the language for the visualforce page.

After Salesforce Summer 23’ release, we have an opportunity to dynamically retrieve labels in the preferred language:

System.Label.get(namespace, label, language);

Also, we can check whether a translation exists:

Label.translationExists(namespace, label, language)

Here are a few examples:

Below is the result when we are trying to get label in language for which translation doesn’t exist:
You can’t access labels that are protected in a different namespace.

2. Manage DML Exceptions in User-Mode Database Operations

Before the new release database methods for user-mode DML operations generated SecurityException, in Summer 23’ they generate the correct DML exception.

DmlException is generated because the required field isn’t populated.
The correct exception is generated in API version 58.0 and later.

3. Query Five Levels of Parent-to-Child Relationships in SOQL Queries

SOQL now supports relationship queries that traverse up to five levels of parent-child records. Use a single SOQL query to get parent-child records from five different levels. This ability is limited to SOQL queries via the REST and SOAP query calls on standards and custom objects.
Works for API version 58.0 and later

4. Create Quotes Without a Related Opportunity

Before the Summer 23’ release opportunity was required before quote creation, after the release quotes must be related to an account when they’re converted to orders.

To enable this functionality when you enable quotes in Quote Settings, select Create Quotes Without a Related Opportunity.
Here is the example that order can’t be created without account:
If at least one quote without opportunity exists in the org, you can’t disable this feature:

5. Use DataWeave in Apex to Enable Data Transformation to Different Formats (Beta)

You can now share DataWeave scripts across namespaces. Specify a namespace name in the new DataWeave.createScript(namespace, scriptName) method overload. Performance is improved with first-time DataWeave script creation and execution. Checks for feature support are done at script creation time instead of at runtime.

Let’s take a look at the example and steps that should be done:
1) Create a new folder in force-app\main\default and name it ‘dw’.
2) Create 2 files in ‘dw’ folder and name them csvToJson.dwl and csvToJson.dwl-meta.xml.
3) It doesn’t depend on which format you’re converting, paste this code to your meta.xml file.
4) The below script converts csv to json
5) Calling DW script in Apex

Our output:

DataWeave in Apex doesn’t support these content types:
● application/flatfile
● application/xlsx
● application/avro

Limitations of DataWeave:
● Apex classes must be at API version 53.0 or later to access DataWeave integration methods.
● There’s a maximum of 50 DataWeave scripts per org.
● The maximum body size of one DataWeave script is 100000 (one hundred thousand) characters.
● DataWeave is constrained to disallow the loading of additional libraries.
In AnyPoint Exchange we have DataWeave Mock Data Generators Library which we want to import to extend functionality. When we are trying to do it we receive an error:

So it can only be done in a way, as in the first example with csvToJson conversion.
● DataWeave modules and importing other scripts aren’t supported. For example, import modules::MyMapping as per Using a Mapping File in a DataWeave Script isn’t supported.
● You must specify the encoding for binary input (Apex Blobs) to be coerced to strings: binaryVariable as String {encoding: 'utf8' }".