Back Forward How to test method results using a transition

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 sound development practice, test this status prefix against Good in those activity steps that may fail. In the Transition area, reference a when condition rule, and branch or jump to handle the failure.

You can use two standard when conditions named @baseclass.StepStatusGood and @baseclass.StepStatusFail in transitions:

To enter a transition:

  1. Click in the step row to make buttons visible.
  2. In the image/img00033.gif column, click the third zzzicon at the right of the row of the step. (After a transition is defined and enabled, this button changes to Transition.)
  3. Enter the second key part of a when condition rule.
  4. In the If True field, indicate what processing will occur when the condition is true.
  5. In the If False field, indicate the processing to occur when the condition is false.
Transition

Notes

NoteThe 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.

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

zzzUsing 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 when rule, the Tracer row is displays the status as Good and has a normal gray background. That is, the transition mechanism is intended to allow you to catch previously unhandled Java RuntimeExceptions, not checked exceptions.

Definitions transition
Related topics Activity form — Completing the Steps tab — Transitions
Activity-Clear-Status method
Activity-Set-Status method
How to customize the activity success and exception windows

UpTechnical category