Hear from Salesforce leaders on how to create and deploy Agentforce agents.
Contact Us 1-800-596-4880

Subflow (<sub-flow/>)

logo cloud IDE Cloud IDE

logo desktop IDE Desktop IDE

Group together a sequence of Core components and operations (provided by connectors and modules) inside a scope that you invoke from a Flow Reference in your Mule application.

The Subflow component works in a similar way to the Flow component but with the following differences:

  • Subflows do not support Mule event sources.

  • Subflows do not have a built-in error handling scope.

  • During design, subflows work as macros that replace the Flow Reference components that call them.

    When you build the application, Mule replaces all Flow Reference components that call a subflow with the contents of the referenced subflow.

  • Referencing subflows results in better performance than referencing a flow.

You can create multiple subflows in your Mule application.

For a more in-depth discussion of uses, capabilities, and limits of flows and subflows, see Flows and Subflows.

Limitations

Because the contents of a subflow replace each Flow Reference component that references that subflow, several instances of the event processors inside that subflow exist in the application at runtime. This behavior can cause issues with event processors that depend on unique IDs or instances to execute.

Component XML

This component supports the following XML structure:

<sub-flow name="mySubFlow">

</sub-flow>
xml

Subflow (<sub-flow/>) attributes are configurable through the UI and XML.

Attribute Name Attribute XML Description

name1 (default)

name

Editable name for the subflow.

Example: Flow and Subflows

The following example uses a Scheduler as a source to trigger the execution of a flow every 10 seconds and then connects to a subflow (<sub-flow/>) through a Flow Ref (<flow-ref/>) component. The subflow then connects to another subflow, also using a Flow Ref component.

The example produces the following output:

{
  "priceList": {
    "basic": {
      "dollars": "9.99",
      "localCurrency": 129.87,
      "index_plus_1": 1,
      "timer": 1533024312658
    },
    "premium": {
      "dollars": "53",
      "localCurrency": 689,
      "index_plus_1": 2,
      "timer": 1533024312659
    },
    "vip": {
      "dollars": "398.99",
      "localCurrency": 5186.87,
      "index_plus_1": 3,
      "timer": 1533024312659
    }
  }
}
json

See Also