Start an Instance
Starts an Instance of a Workflow. You can optionally pass values for the input fields defined on the Workflow.
Permissions Required
You must have Find permissions to the Workflow, and the Workflow must have "Can be started manually" enabled in order to start an instance of this Workflow. Manual starts are enabled by default for Workflows in the Web App.
Method Signature
Instance Start(Guid workflowId, string name = null, IEnumerable<KeyValuePair<string, object>> inputs = null);
async Task<Instance> StartAsync(Guid workflowId, string name = null, IEnumerable<KeyValuePair<string, object>> inputs = null);
Parameters
Parameter | Type | Description |
---|---|---|
workflowId | Guid | The ID of the Workflow to start |
name | string | Optional name to apply to the Instance |
inputs | IEnumerable< KeyValuePair< string, object >> | Optional named input parameters to pass to the Instance. Must match Fields configured on the Workflow. |
returns | Instance | The newly started Instance |
Instance Start(string workflowId, string name = null, IEnumerable<KeyValuePair<string, object>> inputs = null);
async Task<Instance> StartAsync(string workflowId, string name = null, IEnumerable<KeyValuePair<string, object>> inputs = null);
Parameter | Type | Description |
---|---|---|
workflowId | string | The ID of the Workflow to start |
name | string | Optional name to apply to the Instance |
inputs | IEnumerable< KeyValuePair< string, object >> | Optional named input parameters to pass to the Instance. Must match Fields configured on the Workflow. |
returns | Instance | The newly started Instance |
Instance Start(StartInstanceRequest instanceRequest);
async Task<Instance> StartAsync(StartInstanceRequest instanceRequest);
Parameter | Type | Description |
---|---|---|
instanceRequest | StartInstanceRequest | The details of the Workflow to start, including ID, name and inputs |
returns | Instance | The newly started Instance |
See the Instances Quickstart Example for an example of finding and starting a Workflow by name instead of ID.
Example
/*
* This example demonstrates finding a Workflow, starting an Instance of
* that Workflow with some inputs.
*/
using Catalytic.Sdk;
using Catalytic.Sdk.Entities;
using System;
namespace Catalytic.Sdk.Examples
{
class Program
{
// update this to your email before running this sample
public const string YourEmail = "[email protected]";
static void Main(string[] args)
{
// create and initialize the Catalytic SDK Client
var catalytic = new CatalyticClient(Credentials.Default);
var workflow = catalytic.Workflows.Get("c9f2beec-10c0-4f2f-b4e0-1d884c7e053c");
// Set the inputs the Workflow expects
var request = workflow
.SetInput("Age", 42)
.SetInput("Name", "Alice")
.SetName($"SDK Example - {DateTimeOffset.Now.ToString()}");
// Start the workflow
var instance = catalytic.Instances.Start(request);
}
}
}
Updated almost 3 years ago