Skip to main content


         This documentation site is for previous versions. Visit our new documentation site for current releases.      
 

Testing method results using a transition

Updated on January 14, 2022

As an activity executes, the method referenced in each step (implemented in Java) is called and executes. Most methods update the pxMethodStatus property on the pxThread page with a status that starts with one of the values Good:, Warn :, or Fail:. These three values are prefixes to a message key that is looked up as a field value rule.

Optionally, your activities can place additional information about an error or result in the property named pxMethodStatusInfo.

As a best practice, test this status prefix against Good in those activity steps that may fail. In the When dialog, reference a when condition rule, and branch or jump to handle the failure.

In transitions, you can use three standard when conditions: @baseclass.StepStatusGood, @baseclass.StepStatusGood, and @baseclass.StepStatusFail. Note the following information:

  • The StepStatusFail condition returns True when the status is Fail.
  • The StepStatusWarn condition returns True when the status contains Warn.
  • The StepStatusGood condition returns True when the status is Good.
  • The Obj-Validate method does not usually update the pxMethodStatus property. Reference the standard when rule @baseclass.hasMessages to test whether a page contains one or more page messages.

To enter a transition:

  1. Select the Jump button on the step row to open the condition pop-up dialog.
  2. Enter the second key part of a when condition rule.
  3. In the If True field, indicate what processing will occur when the condition is true.
  4. In the If False field, indicate the processing to occur when the condition is false.
  5. Make sure the Enable condition after this action check box is selected, and click OK to save your edits.
    Note:
    • The value in the pxMethodStatus property changes often. The value displayed when you review the clipboard using the Clipboard tool may be stale or deleted. Use the Tracer to see the current value.

    • An activity step can explicitly reset the value of pxMethodStatus to a less severe status by the Activity-Clear-Status method.

    • Using a transition in a step alters the Tracer display for the step. Normally, a red Fail row in Tracer results indicates an unhandled exception condition. If a method returns a Fail status but the step contains a transition, the Tracer row displays the status as Good and has a gray background. The transition mechanism is intended to allow you to catch previously unhandled Java RuntimeExceptions, not checked exceptions.

Have a question? Get answers now.

Visit the Support Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega.com is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us