Example: Workflow parameters and return values (call workflow)

The Workflow Parameters and Return Values screen appears whenever you click the Parameters action. It shows the parameters and return values from the workflow being called.

An example best explains how to use the Workflow Parameters and Return Values screen. The following figure starts this example with a workflow containing variables to hold the input parameters and the return value for a call to a subflow workflow. The example could also be a synchronous workflow, except the parameters could not be required.
Figure 1. Call Workflow task example
The image is explained in the text.

Of course to really be of value this workflow would contain some tasks that would assign values to the variables we are using as the source for our input parameters.

Click Parameters. The Parameters link in the Workflow Parameters and Return Values screen appears. The first time you click the Parameters link the screen does not show any values.
Figure 2. Initial Workflow Parameters and Return Values screen
The image is explained in the text.
Click the Initialize action and the system fills in the initial values in both the Parameters section and the Return Values section based on the workflow being called.
Figure 3. After Initialize action
The image is explained in the text.

The parameter and return value names from the subflow are filled in. One of the parameters is required and therefore does not have a check box to allow selecting it to be deleted.

The variables to use within this workflow have not been assigned yet. Assign them by clicking on the Name. The Workflow Parameter Definition screen appears.
Figure 4. Workflow Parameter Definition screen
The image is explained in the text.
The choices in the Variable drop down are the variables defined on the workflow. Click OK after selecting the Variable. The value displayed in the Required field reflects the value in the workflow being called.
Figure 5. Workflow parameter defined
The image is explained in the text.

Repeat the definition process for the other parameter and the return value. Since the second parameter is optional it could be deleted rather than assigning it a value. You can always choose to ignore any returned values by deleting them. Any that remain in the Workflow Parameters and Return Values screen must be valid, which means the input parameters must be assigned to variables. Any that have with <Not set> in the Variable column will prevent the workflow from publishing.

In the following figure, the second (optional) input parameter has been deleted and the return value assigned a variable.
Figure 6. Optional parameter deleted
The image is explained in the text.
If after deleting a parameter or return value you decide you want it back, click Initialize and assign a variable to it.
Figure 7. All parameters and return values defined
The image is explained in the text.
If the calling workflow has invalid parameters or returns (either required parameters missing or any that do not have a variable assigned), it cannot be published. Attempting to do so produces an error message.
Figure 8. Error message when calling workflow has invalid parameter
The image is explained in the text.
If you were to try to publish the called workflow while there is a calling workflow with invalid parameters or returns, the system displays a warning. As this is a warning message, you can choose to publish it and then go fix the calling workflow(s) later or can cancel and look at the calling workflow(s) now. You can use the Callers link to view the workflows that have problems. Clicking Callers brings up the Calling Workflows Parameters Check screen. Click a hyperlinked Name to open the workflow so the problem can be resolved.
Figure 9. Calling Workflows Parameters Check screen
The image is explained in the text.

Note the Calling Workflows Parameters Check identifies the workflows with errors by showing Invalid in red in the Parameters column.

Within a workflow, Call Workflow tasks that call a workflow with parameters are checked to verify that the parameter and return value mapping is valid. If the mapping is not valid the Call Workflow task is outlined in red and the workflow will not publish. The following conditions make the mapping invalid:

  • A required subflow parameter is not assigned a value.
  • A parameter is assigned and the parameter does not exist on the called workflow (can happen due to modifications to the called workflow after the mapping was defined).
  • A parameter is assigned and the type is not compatible (can happen due to modifications to the called workflow after the mapping was defined).
  • A variable is assigned from a return value that does not exist on the called workflow (can happen due to modifications to the called workflow after the mapping was defined).

When a workflow with parameters and/or return values is published, the system checks calling workflows to verify that the parameter and return value mappings are valid. Any workflows that have invalid mappings an be viewed by using the Callers link.