Apex: New and Changed Items

These classes, enums, and interfaces are new or have changes.

For more information, refer to the Apex Developer Guide.

Cache Namespace

The Cache namespace has these new or changed classes, methods, interfaces, enums, or exceptions.

New or Changed Methods in Existing Classes

Get the average item size among all the keys retrieved from the cache
Use the new getAvgGetSize() method in the Cache.Org, Cache.Partition, and the Cache.Session classes.
Get the maximum item size among all the keys retrieved from the cache
Use the new getMaxGetSize() method in the Cache.Org, Cache.Partition, and the Cache.Session classes.
DEPRECATED: Methods getAvgValueSize() and getMaxValueSize() in Cache.Org, Cache.Partition, and Cache.Session
The getAvgValueSize() and the getMaxValueSize() methods in the Cache.Org, Cache.Partition, and the Cache.Session classes are not supported in version 50.0 and later.

LxScheduler Namespace

The new LxScheduler namespace has these classes and methods, and an interface.

New Classes

Get a list of parameters that are passed to the LxScheduler.ServiceResourceScheduleHandler interface
Use these methods in the new LxScheduler.ServiceAppointmentRequestInfo class. Use the getPrimaryResourceId method to get the ID of the primary service resource. Use the getServiceResources method to get a list of service resources for the time slots that are already booked. Use the getWorkTypeId method to get the ID of the appointment’s work type.
Get information about a service resource
Use these methods in the new LxScheduler.ServiceResourceInfo class. Use the getResourceType method to get the type of the service resource, such as Technician or Asset. Use the getServiceResourceId method to get the ID of the service resource. Use the getTerritoryIds method to get a list of requested service territories for the service resource. Use the getUserName method to get the username of the service resource.
Pass results from your custom Apex class to the LxScheduler.ServiceResourceScheduleHandler interface methods
Use the LxScheduler.ServiceResourceSchedule class.
Pass the list of unavailable time slots for requested service resources to the LxScheduler.ServiceResourceSchedule class
Use the LxScheduler.UnavailableTimeslot class.

New Interface

Allow an implementing class to check service resources’ external calendar events and return the time slots where service resources are booked
Use the new LxScheduler.ServiceResourceScheduleHandler interface.

System Namespace

The System namespace has these new or changed classes, methods, interfaces, enums, or exceptions.

New Classes

Detect current Apex context at runtime with Request ID and Quiddity
Use these new methods in the System.Request class. Use the getCurrent() method to retrieve the Request object that contains the unique identifier for the current Salesforce request and the Quiddity value. Use the getRequestId() method to get the current request ID. Use the getQuiddity() method to get the Quiddity value.

New or Changed Methods in Existing Classes

Enhance security with a new threading behavior for Email-to-Case
Use the getCaseIdFromEmailHeaders method in the System.Cases class to match incoming emails with their header information. The Cases.getCaseIdFromEmailThreadId() method is deprecated.
Check limit usage of platform event immediate publishes
Use the new getPublishImmediateDML method in the System.Limits class to get the number of EventBus.publish calls made for platform events configured to publish immediately. And use the new getLimitPublishImmediateDML method in the System.Limits class to get the maximum limit of EventBus.publish calls.
Dynamically add errors to an SObject field
Use the addError overload methods in the System.SObject class:
  • addError(String fieldName, String message[, Boolean doNotEscape])
  • addError(Schema.SObjectField field, String message[, Boolean doNotEscape])
Know if an SObject instance contains errors
Use the hasErrors method in the System.SObject class.
Get the error details for an SObject instance
Use the getErrors method in the System.SObject class.
Get metadata description for a specified list of SObject types
Use the describeSObjects overload method in the System.Schema class. The default describe option for this method is SObjectDescribeOptions.DEFERRED, which indicates lazy-load child relationships.
Get the short code for the Quiddity value of the current Salesforce request
Use the getQuiddityShortCode method in the System.System class.

New Enums

Use Elliptical Curve Digital Signature Algorithms (ECDSA) with Crypto methods
Use the new ECDSA-SHA256, ECDSA-SHA384, and ECDSA-SHA512 values in the algorithmName parameter in Crypto.sign, Crypto.signWithCertificate, Crypto.signXML(), and Crypto.verify() (methods) in the System.Crypto class.
Specify a quiddity value used by the methods in the System.Request class
Use the new System.Quiddity enum.