Call Subprocess

Reusable functionality within Frends.

To include Subprocesses in your Processes, Call Subprocess shape can be used to execute a Subprocess and obtain a result from it.

What is Call Subprocess?

Call Subprocess shape is used to execute a Subprocess from within a Process or another Subprocess. Subprocesses themselves are reusable Processes, that cannot be started from outside Frends, but that other Processes in your Frends can use over and over.

Image shows a Subprocess call being used in a Frends Process.
Repetitive actions can be simplified in Process by making them into a Subprocess.

Instead of embedding the Subprocess into your Process, Call Subprocess shape sends a message over Azure Service Bus, requesting the execution of the specified Subprocess with provided parameters or data. Once finished, a response is sent back to your Process. This way the Subprocesses stay separate from your Processes, and if the Subprocess is updated, the changes are reflected to your Process as well, without requiring changes there.

Types of Call Subprocess

When using Call Subprocess shape, you need to specify which Subprocess to call. This selection decides what the shape actually does during Process Execution. The Subprocess selection also affects what parameters the shape takes in when creating a Process, as the input parameters are defined by the Subprocess.

Remote call

While being strictly speaking a configuration option for Call Subprocess shape, this option alters the method of how and more accurately where the Subprocess will be executed during Process execution.

In standard use case, with Remote call option set to off, the Subprocess will be executed in the same Agent Group as where the parent Process is being executed.

Because Subprocesses are executed as their own Instances instead of as part of the parent Process, this allows the execution to be moved to another Agent Group if so required. Remote call option does this exactly, allowing the developer to specify where the Subprocess will be executed upon calling it. The selection will be done for each Environment separately, so it's possible to perform remote call for only some Environments, while in others it can be done on the same Agent Group.

Remote call can be useful, if a target system is within your internal network with no connectivity to outside network, but you need the Process or API to be publicly available. Transfering the Subprocess execution to your on-premise Agent Group allows the public Process thus to access the internal resources, without requiring firewall adjustment.

Connection from calling Process to the called Subprocess is made through Azure Service Bus, by sending a request and input parameters to the executing Agent as a message, and then receiving a response message back with results, so there will not be an active communication between the two environments during remote call.

Usage

To use Call Subprocess shape in your Process, simply add it to your Process canvas and connect it as part of your Process, between Trigger and Return or Throw shapes, along with other shapes you need. Optionally, a Catch or Intermediate Return shape can be connected as well, if required.

Once added to your Process, choose the Subprocess to call with this shape, and adjust the display name as required. Once the Subprocess is selected, you can add and adjust its configuration parameters and whether or not the call will be a remote call.

To access the Subprocess's result in your Process, you can use #result reference value after the Call Subprocess shape. You can either use unnamed #result to access the result directly after this shape, or named result as #result[Name of Subprocess Call] to specify the use of this shape's result.

Architecture

The called Subprocess will be executed as its own Instance on the executing Agent Group, meaning the Subprocess will be executed in the same App Domain as the calling Process, but it will have its own execution context and a separate thread. The Process will always wait for the Subprocess to finish before continuing, so it cannot be used for concurrency.

For Subprocess calls, the input parameters are serialized before passing them on the Subprocess execution, where the parameters will first be deserialized. Similarly, the result from Subprocess will be serialized before sending it back to the calling Process, which will deserialize the result before continuing execution.

For remote call Subprocesses, messaging between the calling Process and the called Subprocess is done over Azure Service Bus, meaning there will never be a direct connection open between the two. The input parameters for and results from Subprocess are serialized before sending them over as a Service Bus message.

Configuration

To set up a Call Subprocess shape, add it to your Process canvas and connect it to your Process flow using Sequence flows. After this, you can configure the shape to required Subprocess and values.

The following configuration parameters exist for Call Subprocess shape.

Display name

Shapes can be given a display name in Frends Processes to distinquish them from each other. Shape's display name has no technical purpose and is only for documentational and visual purposes only. For shapes returning a #result reference value, the display name can be used to specify which result is meant.

Display name is given to the shape by double-clicking it on the canvas or through its configuration parameters.

Subprocess to call

Call Subprocess shape's Subprocess to call specifies what Subprocess is called and thus what parameters it has available.

Subprocess chosen will be executed as its own Instance, instead of as part of the current Process. Input parameters for and result from the Subprocess are serialized before being transferred over.

Skip logging result and parameters

Toggle option to select if the values of this shape should be included in logging or not. Default is false. If set to true, Process Instance logs will show the result and parameter values of this shape as << Omitted >>.

Promote result as

Toggle option to select if the result value of this shape should be promoted in the Process Instance list, and an text input field if set to true. Default is false. Promoted values appear in the Process Instance list in their own column along with error and result values. Promoted value column is named with the text input field appearing when this is set to true.

Promoted values are always logged fully in the Process Instance view, regardless of the log level settings.

Remote call

When enabled, this toggle option allows the execution of the Subprocess over on another Agent Group in the same Environment. Agent Group which executes the Subprocess can be set for each Environment separately.

If using remote call to call the Subprocess, input parameters for and result from the Subprocess are delivered over Azure Service Bus.

Reference Values

Call Subprocess shape provides a #result reference value, which contains its operation's result values.

#result

#result reference value can be used to access earlier shape's return value. For Scope shapes, the value is specified using Return shape, while for Task's the #result is populated directly by the Task.

Example of result reference value being used to return a value from Process.
Result reference value used to return the Task's result as response from the Process.

When Return shape is used to end Foreach or While shapes, the expression or HTTP content values in Return shape are available through #result reference value as an array of values for each iteration.

#result reference value by default references the last Task's or Scope shape's return value. Instead of unnamed #result reference, you can also use named #result reference value.

Named #result

Named #result reference value is used with square brackets, much like dictionary's or object's fields would be used, such as #result[Handle elements] or #result[HTTP Request]. This way it can be specified which shape's result you are using.

When using named #result reference value with Scope shapes and Return shapes, it should be noted that the #result reference value is named by the Scope shape and not by the Return shape, although the value is specified in the Return shape. Thus, when using the named #result value, such as #result[Handle elements], the Scope shape's name should be used.

Last updated

Was this helpful?