Skip to main content


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

This content has been archived and is no longer being updated.

Links may not function; however, this content may be relevant to outdated versions of the product.

How to call a function rule within the Java code of an edit validate rule

Updated on September 13, 2021

Summary

When attempting to save a Rule-Edit-Validate form that calls a Rule-Utility-Function within the Java code, the following error may appear:

Test compilation failed:
Error in <pegarules_temporary_path>\Rule_Edit_Validate_<rule_name
>_<datetime_stamp>(generated Java code line number)
<library_name>.<function_name>(function parameters)
<library_name>.<function_name> cannot be resolved

Suggested Approach

Explanation

When you save a Rule-Edit-Validate form, Process Commander generates the full Java code for the rule, which you can view by clicking the Java coffee cup icon on the toolbar

Unlike other rule types such as activities, there is no import statement for generated Java classes in the ‘com.pegarules.generated’ package at the top of the generated class.

Because the import statement is not available, the compiler cannot resolve the class of the function referenced in the rule, and thus cannot successfully compile the class.

Workaround

Avoid this error by providing the fully-qualified Java class name of the function in your Java code within the Rule-Edit-Validate rule.

The fully qualified class name for functions includes the package name.

The package name for all functions is ‘com.pegarules.generated’. Thus if your prefix com.pegarules.generated to the function reference, the rule will save and compile correctly.

Tags

Pega Platform 7.1.1 - 8.3.1 Business Architect System Architect Low-Code App Development Case Management

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