Function rules
Completing the Create or Save As form

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

Records can be created in various ways. You can add a new record to your application or copy an existing one.

Based on your use case, the Create or Save As form is used to create the record. The number of fields and available options vary by record type. Start by familiarizing yourself with the generic layout of these forms and their common fields:

This help topic then identifies the key parts and options that are applicable to the record type that you are creating.

Create a Function rule by selecting: +Create > Technical > Function.

Key parts:

A Function rule has two key parts:

Field

Description

Library Name

Select the name of an existing library rule in the ruleset that is also to contain this function.

Note: Create a library rule before creating any functions for the library.

Identifier

Enter a name for a function. Begin the name with a letter and use only letters and digits. The name must be a valid Java identifier; see How to enter a Java identifier.

Overloading functions

You can choose a function name that already exists in that library (or other libraries of that name), if the type, order, and number of the new function's parameters are not the same as the type, order, and number of the existing function's parameters. The function name and parameter types together are known as the signature.

To overload a function, open the original function and use the Save As toolbar button.

If one function has multiple signatures, the system generates a hash function of the parameter types to distinguish them internally. When calling a function, the appropriate instance is matched based on signature.

Input parameters

The Name and Java Type input parameters are defined on the Create and Save As forms.

There must always be at least one parameter present, although the field can be left blank if the Rule-Utility-Function rule has no parameters. Clicking delete on the first row when it is the only one parameter present deletes the contents of the field, but not the row.

Note: Once a function is created, the total number of, order, and type of parameters cannot be changed.

For reference purposes, a hashed version of the input parameters is contained within the rule signature.

Field

Description

Name

Enter a variable name that is an input to the function.

After creation or initial save of this form, this field can be updated on the Parameters tab.

Java type

Enter a type for this parameter, such as String, Page, or Activity. The types that you can enter depend on the packages imported in the Packages tab on the Library form where the function belongs.

Note: After creation or initial save of this form, this field cannot be updated.

When the system generates the Java from a function rule, it converts an Activity parameter type to a PublicAPI parameter type. This conversion is automatic. Do not manually enter PublicAPI as the type.

Similarly, the conversion from Page to ClipboardPage is automatic. The system performs these conversions in a way that allows the function rule to be called in a Java step in an activity whether it uses the 02 or 03-02 version of the PublicAPI.

Note: When you need to use Java.Util.Date, set the Java type field to String.

Validation

When initially creating or saving input parameters, Pega 7 performs a validation check for duplicate functions, such as those that have the same signature in the same ruleset version.

At this time, the system also validates the following conditions for parameters:

Up About Function rules