corda / net.corda.core.flows / FlowLogic / subFlow

# subFlow

`@Suspendable @JvmOverloads open fun <R> subFlow(subLogic: FlowLogic<R>, shareParentSessions: Boolean = false): R`

Invokes the given subflow. This function returns once the subflow completes successfully with the result returned by that subflows call method. If the subflow has a progress tracker, it is attached to the current step in this flow's progress tracker.

### Parameters

`shareParentSessions` - In certain situations the need arises to use the same sessions the parent flow has already established. However this also prevents the subflow from creating new sessions with those parties. For this reason the default value is false.

### Exceptions

`FlowException` - This is either thrown by subLogic itself or propagated from any of the remote FlowLogics it communicated with. A subflow retry can be done by catching this exception.