Table of Contents

Article

Best practices for using the SAVE directive

Summary

When the save JSP tag (or directive) is used in a hand-crafted XML rule, HTML rule, HTML property rule, or other stream rule, choose a value for the name attribute that is unique application-wide or even system-wide..

 

Suggested Approach

The save JSP tag saves a name/value pair to a temporary scratchpad during stream processing. execution.

As an example, suppose that one HTML rule contains the following JSP tag:

<pega:save name=”result” ref=”.Total” />

If a completely separate HTML rule sets the name “result” as well, a collision of values may occur.

<pega:save name=”result” ref=”.FinalPrice” />

If an activity calls the first HTML rule and later called the second HTML rule, the first would set the temporary save name of “result” to the value in the .Total property. 

The second rule resets this temporary save name to the value in the .FinalPrice property.  If subsequent rules expect the .Total property value, the application will fail or return unexpected results.

To avoid this issue, create specific or unique names for the save tag. 

Examples

<pega:save name=”TotalResult” ref=”.Total” />

<pega:save name=”PriceResult” ref=”.FinalPrice” />

This prevents the system from overwriting values on the scratchpad and, as a result, returning unexpected results.

NOTE:  Do not use any values beginning with px, py, or pz. These are prefixes reserved for internal Pega object names, and can also cause unpredictable results if used as a save name.

Tags:

Published May 1, 2008 — Updated May 2, 2008

Have a question? Get answers now.

Visit the Pega Support Community to ask questions, engage in discussions, and help others.