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 the 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 the 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.
From a given Action, you can call another Action only when it satisfies all of the following conditions:
- Destination Context of the called Action must either match with the Destination Context of the Action where it is called or it should be “Current Context”. More about Destination Contexts.
- Called Action should be available in the Context of the Action where it is being called. Either the called Action should belong to the same Context as the Action where it is being called or should have been shared with the Context of such Action. More about Action sharing.
- 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.