Defining Input-Output Parameters of a Subroutine

To define input and output parameters for a subroutine:

  1. Navigate to the Flows tab.
  2. Right-click the flow name in the product and navigate to module > flow tree structure in the left pane. Select More > Define Subroutine Interface.
  3. Specify the parameters the subroutine expects from the calling flow and the parameters the subroutine exposes to the calling flow.

    Example: If the subroutine creates an Account, it expects a personId value to be provided for it to create an Account. After an account is created, it returns the accountId. The subroutine should be defined with one input variable “personId” and another output variable “accountId”.

  4. Add additional input/output variable.
    1. Click Add IN/OUT Variable.
    2. Enter the name and parameter type.
  5. Click Save.

    Figure 8-27 Subroutine interface output variables

    Shows a subroutine interface definition for a flow that creates both a person and an account.

    This figure shows a subroutine interface definition for a flow that creates both a person and account and exposes personId and accountId as outputs, so they can be used by the calling flow.

  6. After a subroutine is added to a flow calling a subroutine, map the input or output variable(s) of the subroutine.
    1. Right-click the subroutine in the flow tree structure of the calling flow and select Edit Test Data.
    2. The Test Data page for subroutine has the following test data related sections:
      • Variable: To create new flow variables in the calling flow, so that the values exposed by the subroutine can be mapped to these flow variables and used in other components within the calling flow.
      • IN: Shows the inputs needed by the subroutine, as defined in the subroutine interface. Input values need to be provided appropriately for the subroutine to run.
      • OUT: Values exposed by the subroutine through its interface definition. In order to use the exposed values in the calling flow, these OUT values need to be mapped to the calling flow variables defined in the Variable section.
    3. Map the input/output variable of the subroutine to a variable in the calling flow. The variables defined inside the subroutine interface cannot be directly accessed by other components in the calling flow. The way to access the data exposed by the subroutine is to create variables in the calling flow and map the output from the subroutine to these flow variables.
Example: The subroutine might be exposing accountId as it is the variable value. To use the exposed variable in the calling flow, create a new variable in the calling flow using Create New Variable. Map the output accountId variable from the subroutine flow to the newly created variable in the calling flow. This new variable can be used in the test data GUI of any component that succeeds the subroutine in the calling flow.

Figure 8-28 Subroutine Test Data and Input Parameters

Shows the Edit Test Data screen for a subroutine that outputs a personId and accountId.

Figure 8-29 Subroutine Output Parameter Mappings

Shows the Edit Test Data screen for a subroutine that outputs a personId and accountId.

These figures show the Edit Test Data page for a subroutine that outputs a personName and accountId. New variables, personName and accountId are created and the outputs of the subroutine (gVarAccountId1 and gVarPersonId1) are mapped to the newly created variables.