Action Logic Editor allows calling one Action from another Action's logic. This may be helpful in multiple situations.
Call-Action for reusability
You have a reusable block of logic that is relevant in multiple Actions. Consider you have two Actions
- Verify Home Page
- Verify Summary Page
In both these Actions, you may need to verify the header links. Rather than duplicating this logic in both Actions, you may build this common logic in a separate Action called, Verify Header Links.
Now, both the Home Page and Summary Page verification logic can "call" the Header verification Action.
Action 1: Verify Home Page
Call: Verify Header Links
<logic to verify other aspects of home page>
Action 2: Verify Summary Page
Call: Verify Header Links
<logic to verify other aspects of summary page>
Call-Action to build modular and readable logic
You may want to break down a single Action into multiple parts for the purpose of clarity and readability.
Example: Consider the Action, Populate Payment Page which populates information on payment type, shipping preference, and shipping address. Even though it is possible to write entire logic in a single Action, the logic may turn out to be too long and unreadable. Breaking down these parts into multiple Actions greatly helps with readability and maintainability.
Action: Populate Payment Page
Call: Populate Payment Type
Call: Select Shipping Preference
Call: Enter Shipping Address
Call: Submit Order
How to call an Action
To call an action in the logic, type "call" and then select the Action to call. If the called Action requires any input parameters, you will be prompted to provide values. You can also capture output from the called Action into a local or Action output parameter of the "calling" Action.
Which Actions can be called?
In order to maintain a proper separation of concerns and adhere to the core principles of modularity and reusability, ACCELQ places certain restrictions on which Actions can be called from a given Action. Not every Action can be called from any other Action. Here are the rules of eligibility.
An Action may be called from another Action only when the Origin & Destination Contexts of the "called" and "caller" Actions have a match. The following rules apply:
- The Destination Context of the called Action must either match with the Destination Context of the "caller" Action or it should be “Current Context”.
- The Origin of the "called" Action must be part of the Origin Context of the "caller" Action.
- Action calling should not create a “recursive” situation where Actions call each other cyclically. ACCELQ will check for this condition automatically when you are inserting a "call" statement.
- An Action cannot call itself.