Manage a Group of Actions and Fault Handlers with a Scope Action

You can manage a group of actions with a scope action. The scope action is essentially a collection of child actions and invokes that can have their own fault handlers. The scope action provides the behavior context for the child elements. The elements defined in the parent scope have local visibility inside this scope. Anything that you can do in an integration such as designing invokes, mappings, and actions can be done in a scope action.

Note:

Scopes can have fault handlers in which specific faults can be caught and rethrown. However, in the case of connectivity agent-based invokes, the named fault handlers are not processed. All fault handling must be done in the default fault handler.

Create a Scope Action

  1. Add a scope action to an integration in either of the following ways:
    • On the right side of the canvas, click Actions Integration actions icon and drag the Scope action to the appropriate location.
    • Click Add icon at the location where you want to add the scope action, then select Scope.
  2. Click Edit Edit icon under Edit Scope to enter a name and optional description for the scope action.

  3. Drag and design appropriate actions, mappings, and invokes into the scope action.


    Scope with JavaScript and Assign actions added to it

    The scope includes a default fault handler that is accessible by clicking the scope action and selecting Actions Actions icon, then Fault Handlers, then Default Handler.


    Trigger action and Fault Handler action are shown.

  4. Click + to define actions on the default fault handler.
  5. To return to the scope action, click the fault handler, and select Actions Actions icon, then Show Scope Block 'scope_name'.
    When you add invokes to a scope, the named faults associated with the invokes are added to the default fault handler in the scope. For example:
    1. Add and configure an invoke connection inside the scope action (for example, a REST Adapter).
    2. Click the scope and select Actions Actions icon, then Fault Handlers.

      In addition to the Default Handler, an invoke fault handler has been added.


      Scope action is clicked and the Actions menu is selected to show Fault Handlers selected. To fault handlers are shown: Default Handler and APIInvocationError REST.

    These are faults that the invoke can handle. The uniqueness of the named faults is defined by the qname of the fault. If there are multiple invokes that define the qname fault, the fault (at runtime) can respond to any invoke. The various invokes cannot be differentiated if their qnames are not unique.
  6. Select appropriate named faults.

    You can also define catch all blocks for fault handling through use of the raise error action in the Fault Handler section of the scope action. Catch all blocks are processed if an invoke throws a fault, but there is not a specific catch named for it. See Catch Faults with a Re-throw Fault Action.

  7. Collapse the scope action by double-clicking it. You can expand it again by double-clicking it, selecting ActionsActions icon, then Expand, or clicking >.

Note:

For application integrations with multiple REST Adapter invoke connections, only one handler can be defined when there are multiple invokes in an integration with scopes. Though the fault handler options are available for each invoke in the scope, it always points to one single handler.

Add Nested Scopes to a Scope Action

You can add nested (child) scope actions to a basic scope action. This provides a more sophisticated way of organizing or separating actions into a subsection of the integration. A nested scope provides the following capabilities:
  • Behaves the same way as a basic scope. It provides its own container of child actions and fault handlers.
  • There is no limitation to the levels of nesting. Even a scope’s fault handlers can have nested scopes.
  1. Drag a scope inside an existing scope.


    A scope is shown that includes a Javascript action, an assign action, and another scope.

  2. Add actions and fault handlers to the nested scope, when necessary.

Track the Status of a Scope Action During Runtime

You can track the status of the scope action in the Tracking Details page through the tracking diagram and activity stream for an activated integration. This is only possible if there is a tracking instance.
  1. In the navigation pane, click Observability, then Instances.
  2. Click the business identifier value of the integration to track.

    Depending upon runtime processing, several scope processing states can be displayed in the diagram:

    • Scope processing succeeds and is displayed in green. Because the fault handler is not processed, the Fault Handler section of the scope remains hidden.

    • Scope processing fails and is displayed in red, but the fault handler succeeds in handling the fault and is displayed in green. Processing continues after the scope. Because the fault handler was processed, the Fault Handler section of the scope is visible.

    • Both the scope and fault handler fail. Both are displayed in red. Both the scope and the Fault Handler section are displayed.

See Track the Status of Integration Instances for additional details.

Rename a Scope

  1. Open the integration that includes the scope to rename.
  2. Click Collapse icon to collapse the scope action.
  3. Click the scope and select Actions Actions icon, then Edit.
  4. Change the name and click Save.