You can create a function to run Java code that you define. By putting your logic in a reusable function, you can reduce the amount of custom code in your application.
In the Dev Studio header, click.
On the Create form, enter values that define the context of the function.
In the Add to ruleset field, select the name and unlocked version of a ruleset that stores the function.
- In the Library field, press the Down Arrow key and select the library to contain the function. The library must be defined in the same ruleset as the function.
Define the input parameters for the function.
In the Parameters section, click + Add new.
In the Name field, enter a unique identifier that you can reference from your Java code.
In the Java type field, enter a primitive data type, a reference data type, or a Pega data type that your library supports.
Do not use PublicAPI or ClipboardPage, because your application manages these types internally. Use Activity or Page, respectively.
Click Create and open to open the Function rule form.
section, in the
field,either enter the return type: a primitive data type, a reference
data type, or Pega data type that your library supports, or if there is no return type,
- In the
Input parameters section, customize the function's input
- In the Name field, you can override the name that you provided on the Create form.
- If the Java type is String, then in the Pega type field, you can choose a data type so that additional validation is performed at run time. For other Java types, leave this field blank.
various fields that are used for documentation purposes.
These values make it easier for other developers to understand your function, but they do not affect run-time behavior.
- In the Input parameters section, enter values for the Description , Page class , and In/out fields. The Page class field is used only for ClipboardPage parameters.
- In the Output section, enter values for the Pega
type and Page class fields.
- In the Pega type field, enter a value only if the Java data type field is set to String or a primitive data type.
- In the Page class field, enter the class of the return value only if the Java data type field is set to ClipboardPage .
- In the Classification section, enter values for the Usage type and Description fields.
- To help with debugging, in the Rule type parameters section, enter one or more rule types. For more information, see Making a function traceable .