Component workflows
Use Component workflows to reuse workflows by including them in other workflows. You can start your workflow from:
- Another workflow in your Office 365 tenancy, by using the Run Component workflowaction.
- Any HTTPS-capable application, by sending an HTTPS Post request.
Only site workflows can be created as component workflows. List workflows cannot be configured as a component workflow but they can call a component workflow.
- Ensure that the feature Workflows can use app permissions is activated for the SharePoint site. For more information and instructions, see Allow a workflow to use add-in permissions on a SharePoint site.
- The workflow or external application that starts the Component workflow must include the start variables defined by the Component workflow.
- To learn more about Component workflows, follow the Nintex for Office 365 - Extensibility course on Nintex University.
Component workflows enable you to:
- Reuse and share workflows.
- Separate processes for security reasons.
- Implement consistency e.g. for approval processes.
The maximum depth limit when calling component workflows is set to one. The parent-child workflow depth cannot exceed one. For example consider the following scenarios with different depths:
- Scenario 1: A List workflow is designed to start Component workflow 1 and Component workflow 1 starts Component workflow 2. This workflow will fail in this scenario as the depth exceeds the limit as shown below:
- List workflow (depth 0)
- Component workflow 1 (depth 1)
- Component workflow 2 (depth 2)
- Scenario 2: Component workflow 1 that starts Component workflow 2 is added to a workflow. The workflow is successful because the depth does not exceed the limit value as shown below:
- Component workflow 1 (depth 0)
- Component workflow 2 (depth 1)
Configure a site workflow as a Component workflow
A site workflow must be configured as a component workflow to allow other workflows or external applications to call it.
In the Designer:
- From the toolbar, select Settings. The Workflow Settings window opens.
- Select the Enable Component workflow checkbox.
- Enable the Call Component workflow from options as required.
-
To inherit the initiator and manager values from the workflow being called, select Inherit initiator and manager values (login name, display name, email address) from the calling workflow. This option is available only when Other workflows in this Office 365 tenant is enabled.
- Click Save.
-
Create your workflow design.
-
Create output variables.
Configure output variables for your component workflow- On the toolbar of the Designer page, click Variables.
- Click New.
- Type the variable Name.
- Select the Type.
- Select the variable flow type.
- Initiation: Variables that are passed from the parent workflow to the component worklfow. Not available for GUID, Integer, Dictionary, and Collection variable types.
- Output: Variables that are passed from the component workflow to the parent workflow after the component workflow runs.Not available for GUID, Choice, Person or Group, Hyperlink, Dictionary, and Collection variable types
- Click Save.
When you configure the action in the parent workflow, you must configure the initiation variables that pass to the component workflow and the output variables that pass from the component workflow to the parent workflow.
- Follow the steps below to publish the component workflow.
On the toolbar at the top of the Designer page, click Publish.
In the Publish dialog box, fill in the fields and then click Publish.
Nintex for Office 365 generates the URL for the component workflow, if you selected External applications, using using a HTTPS API endpoint as the component workflow start option.
Start the component worklfow
- Design the parent workflow that you will use to call the component workflow.
- Include the action at the point in the workflow you want to call the component workflow.
- Configure the Run component workflow action:
- Select the Component workflow to run.
- Select one of the following options:
Wait for Component workflow to complete before continuing: Runs the other actions in the workflow after the component workflow has completed. Select this option if you want output variables from the component worklfow to be passed to the workflow you are designing.
- Run both workflows concurrently: Runs both workflows at the same time.
- On the toolbar at the top of the Designer page, click Publish.
You can start your Component workflow from any service or application that can do the following:
- Make POST calls to HTTPS endpoints.
- Send a request payload in the body with a content-type of application/json.
-
If your application or service can consume OpenAPI Specifications, you can import the specification of the Component workflow using the OpenAPI Specification URL.
-
30 calls to component workflows can be made per 60 seconds across the tenant.
-
Configure your application to make a POST request to the Component workflow URL.
- To the right of the workflow you want, click .
- Select {.} API endpoints.
-
In the Component workflow dialog box, to the right of URL with token, click Copy.
- Configure your application to submit a JSON request body with the start variables.
- To the right of the workflow you want, click .
- Click {.} API endpoints.
- In the Component dialog box, to the right of Request body, click Copy.
-
If you want the Component workflow to call another endpoint when the workflow completes, configure the callbackURL field in the request payload. All callback URLs are sent as HTTPS POST.
The Component workflow endpoint returns only the workflow ID of the called workflow. If you want to retrieve data from the completed workflow, you must accept it via a callback URL.
Example of a request bodyThis request includes two start variables (first name and last name) and a callback URL.
{
"startData": {
"se_firstname_11": "John",
"se_secondname_21": "Smith",
},
"options": {
"callbackUrl": "https://callbackurl.com"
}
}Example of a callback post bodyThe request sent to the callback URL includes:
-
Workflow information
-
Start variables (prefixed with se)
-
Workflow variables that were designated as 'output' variables in the workflow design (prefixed with c).
{
"returnData":{
"c_status":"Review",
"se_firstname_11":"John",
"se_secondname_21":"Smith"
},
"workflow": {
"id":"a58a5b90-eda6-41af-8acb-00fe299c68a6",
"name":"",
"publishedId":"3cace836-0323-4f79-b56f-5480bf79aab7"
}
} -
In the Workflow Gallery:
In the Workflow Gallery:
Example Component workflow
You can design a component workflow to reuse as a generic workflow that can be called from multiple parent workflows.
For example, a workflow has to be created to raise purchase orders. The purchase order raising process includes a separate process to check if an account exists in Salesforce. If a Salesforce account exists, the purchase request note is added to it. If a Salesforce account doesn't exist, one is created.
Instead of re-creating the Salesforce process each time you design purchase order workflows, you can do the following:
- Create a Component workflow in your Office 365 tenant for the Salesforce process.
- Create a workflow to raise the purchase order and add the action to it at the point where you want to call the component workflow to run the Salesforce process.
-
Configure the Run Component Workflow action to Wait for Component workflow to complete before continuing in the parent workflow. The parent workflow is dependent on the Component workflow as it requires the output variable.
Set up the following variables in the Salesforce Component workflow for the following purposes:
- To pass values from the parent workflow to the Component workflow.
- To pass values from the Component workflow to the parent workflow.
- The Component workflow remains generic and reusable.
Variable name |
Variable type |
Initiation/Output |
Comments |
---|---|---|---|
AccountName | Text | Initiation | This is the account name passed from the parent purchase order workflow to the Component workflow. Specifically, the variable is passed to a Salesforce query record action, which checks if the Salesforce account exists. |
AccountsReturned | Integer | Output |
This is the record of whether Salesforce accounts are found for the AccountName or not. |
The base URL of all Component workflow endpoints is the same:
https://{tenancyName}.sharepoint.com/api/v1/componentworkflows/{componentWorkflowId}
Where:
-
{tenancyName} is the name of your tenancy, for example acme https://acme.sharepoint.com
-
{workflowID} is the unique identifier of the Component workflow.
Each API call must include the authentication token:
https://{tenancyname}.nintex.com/api/v1/componentworkflows/{componentWorkflowId}?api-key={token}
Create and start a workflow instance. If an instance token for a paused instance is supplied, start that paused instance.
Payload: |
JSON object in request body containing:
|
Response: | Workflow ID of the started workflow. |
The Component workflow endpoint returns only the workflow ID of the called workflow. If you want to retrieve data from the completed workflow, you must include a callback URL in the request payload.
HTTPS status code |
Description |
---|---|
202 | Accepted |
400 | Bad Request |
404 | Not Found |
500 | Internal Server Error |
503 | Service Unavailable |