You are here: Reference > Rule types > Functions > Function form - Completing the Java tab

Function form – Completing the Java tab

  1. About
  2. New
  3. Parameters
  4. Java
  5. Alias
  6. Imports & Exceptions
  1. History
  2. More...

Enter the Java source code of the function in this tab.

Compilation Status

Field

Description

Function ready to be Compiled?

Leave this check box cleared until you finish coding the function.

At any time when this check box is cleared, another application developer can create another function with the same name. If you select this check box but your function does not work correctly, you might unintentionally prevent other developers from completing work that they could otherwise complete.

After you've tested the function and confirmed that it is ready for use, select this check box and save the rule instance.

Ordinarily, select this check box before you check in the updated function rule. A warning appears if you check in a function that is not marked as ready.

Test Function Compilation

After you have saved the instance, but before you click Generate Library, click to find any language errors.

Generate Function

Click to generate the function and the library that contains it.

Generate Library

Click to update the library on the Pega Platform system (on the current node only).

Caution: Do not click this button until you have clicked Test Library Generation and performed other testing to confirm that your function works as intended. If you generate a library that includes compilation errors, but has the same ruleset and version as a previously generated library that compiled, the older, working CLASS files are overwritten. This can affect processing of other users of the library

Authoring

  1. In the Java source field, enter your Java code, which might call methods in the PublicAPI.
  2. Save the Function rule form.

Notes:

Use this function to reference the activity passed in:

CallingActivity.getPage(...)

Two frequently used Java API methods are createPage() and getPage(). Consult the JavaDocs topics for the PublicAPI interface to learn more about the available methods and their parameters.

See More about Function rules for additional guidance on Java code you can use here.

Access the Parameters tab to compile the library, including this function, when you are ready to test.

Use the String.equals() Java method, not the == or != operators, to compare the value of a property to a literal string or to the value of another property.

Caution: The Java code in a function rule is restricted to computations and limited types of side effects. You can't perform stateful processing, use member variables or extend classes in a function.