Skip to main content


         This documentation site is for previous versions. Visit our new documentation site for current releases.      
 

Function rule

Updated on August 10, 2022

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. Consider hosting complex Java processing in a dedicated reusable service with a REST API, and integrate your application with that service by using the Connect REST 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.

Have a question? Get answers now.

Visit the Support Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega.com is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us