Defining the local variables for an activity

Use the Local Variables section to create scalar variables. Local variables are stored together as fields in the Java class that the Pega Platform generates to implement the activity. These require less memory and execute faster than regular parameters. They are often used to pass information from step to step.

Local variables do not appear on the parameter page.

A local variable of type StringBuffer may be assembled in multiple steps, as a Property-Set on a StringBuffer appends the value to the StringBuffer.

Use the Local keyword to reference a local variable in a Property-Set method.

Note: To avoid Java null pointer exceptions, the system initializes String local variables to the empty string, and the StringBuffer local variable as:
public StringBuffer aBuffer = new StringBuffer();
Accordingly, do not list a local variable as the destination for an Out parameter. Do not pass a parameter reference as the destination for an Out parameter, unless passing the entire parameter page.
Field Description
Local Variables  
Name Enter the name you choose for the local variable, any legal Java identifier. See How to enter a Java identifier. Don't choose a name that starts with pz or any of the reserved names.
Description Enter a text description of this local variable, for information only.
Data Type Select the type of data that is expected as the value for the variable. Choose:
  • String for a Java.lang.string object
  • String Buffer for a Java StringBuffer object
  • int for a Java int
  • double for a Java double
  • boolean for a Java boolean
  • char for Java char
  • BigDecimal for the BigDecimal class
  • Object for any Java object
Local Action for Parameter Display  
Local Action Optional. Specify a flow action to use at runtime to produce a prompt form in which a user can enter values for the flow parameters specified in this tab.