Function rule

A Function rule defines a Java method that is accessed through rule resolution. By using rule resolution at run time, a function can express different behavior depending on the application ruleset list. You can invoke functions from expressions, from activities, and from Java.

Functions are defined within a library; both the library and its functions must be defined in the same ruleset. A Function rule defines the parameters and the Java code that is invoked when calling the function.

After you define a function, you can define one or more function aliases to customize the parameter descriptions and default values.

CAUTION:
The Java code in a Function rule is restricted to computations and limited types of side effects. You cannot perform stateful processing, use member variables, or extend classes in a function. For complex Java processing, use the Connect Java rule.

Predefined functions

Pega Platform includes many predefined functions. To see if a function you need has already been defined, you can use the Expression Builder to list the functions that are defined in each library.

Offline functions

Java functions are not supported in offline mode. If you require an offline function, you must create its JavaScript equivalent.