Share Extensible Functionality with the Callable Interface

The System.Callable interface enables you to use a common interface to build loosely coupled integrations between Apex classes or triggers, even for code in separate packages. Agreeing upon a common interface enables developers from different companies or different departments to build upon one another’s solutions. Implement this interface to enable the broader community, which might have different solutions than the ones you had in mind, to extend your code’s functionality.

Where: This change applies to Lightning Experience, Salesforce Classic, and all versions of the Salesforce app in Enterprise, Performance, Unlimited, Developer, and Database.com editions.

Why: Instead of implementing the Process.Plugin interface for use cases it wasn’t designed to support, you can now implement System.Callable. Simply invoke Callable to make a common point of agreement between pieces of code from different parties.

How: To implement the Callable interface, you need to write only one method: call(String action, Map<String, Object> args).

In code that utilizes or tests an implementation of Callable, cast an instance of your type to Callable.

This interface is not intended to replace more specific interfaces. Rather, the Callable interface allows integrations in which code from different classes or packages can use common base types.