Summer 23 APEX feature is out with a lot of exciting options. In this blog, I will tell you about my favorite APEX Features for summer 23 release and continue my journey in the other areas. Stay tuned.
Access Labels in Apex Dynamically
Use the System.Label.get(namespace, label, language) method to get a custom label, optionally user can mention the Language.
Retrieve the label for a default language setting or for a language and namespace by using
System.Label.get(namespace, label, language).
To check if Translation exists or not, use
Label.translationExists(namespace, label, language)
User can not access labels which are protected in a different namespace.
Set is Iterable, Seriously
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.
Set<String> letters = new Set<String>{'a','b','c','d'};
for (String singleLetter : letters) {
System.debug(‘Letter ’+ singleLetter);
}
Query 5 Levels of Parent-to-Child Relationships in SOQL Queries using Rest and SOAP
Queries now traverse up to five layers of parent-child records using SOQL. Retrieve parent-child records from five distinct levels using a single SOQL query. However, this is limited to REST or SOAP query calls and supported both standard as well as custom object. This is one of the coolest feature of Summer 23 APEX release.
This is supported!!
SELECT Name,
(SELECT LastName,
(SELECT AssetLevel,
(SELECT Description,
(SELECT LineItemNumber FROM WorkOrderLineItems)
FROM WorkOrders)
FROM Assets)
FROM Contacts)
FROM Account
DML Exception in User Mode, a cool Summer 23 APEX feature
Gone are the days of SecurityException in case of user-mode DML operations. After summer 23 Apex release, the user-mode DML operations generate the correct DMLException. This behavior is for API version 58.0 and later versions.
Account acct = new Account();
try {
insert as user acct;
Assert.fail('DmlException expected due to missing Name field');
} catch (Exception ex) {
Assert.isTrue(ex.getMessage().contains('REQUIRED_FIELD_MISSING'));
// This assertion fails with API versions below v58.0 because a SecurityException is generated
Assert.isInstanceOfType(ex, DmlException.class);
To find the coolest Sales Cloud Summer 23 feature, click here
Health Cloud Salesforce Summer 23 release feature
Service Cloud Salesforce Summer 23 release feature
Disclaimer : This article is not endorsed by Salesforce or any other company in any way. This is my view and knowledge on the topic which I wrote. Please always refer to Official Documentation for the latest information.

Leave a Reply