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
start(string $workflowId, string $name = null, array $inputs = null): Instance
Parameters
Parameter | Type | Description |
---|---|---|
$workflowId | string | The ID of the Workflow to start |
$name | string | Optional name to apply to the Instance |
$inputs | array | Optional named input parameters to pass to the Instance. Must match Fields configured on the Workflow. |
returns | Instance | The started Instance |
Example
<?php
/*
* This example demonstrates finding a Workflow, starting an Instance of
* that Workflow with some inputs.
*/
require_once(__DIR__ . '/vendor/autoload.php');
use Catalytic\SDK\CatalyticClient;
$catalytic = new CatalyticClient();
$instance = $catalytic->instances()->start('c9f2beec-10c0-4f2f-b4e0-1d884c7e053c');
You can pass inputs to your Workflow Instance by passing in an array of fields as shown in the following example.
<?php
/*
* This example demonstrates starting a Workflow
* with specific inputs.
*/
require_once(__DIR__ . '/vendor/autoload.php');
use Catalytic\SDK\CatalyticClient;
$catalytic = new CatalyticClient();
$workflowId = 'c9f2beec-10c0-4f2f-b4e0-1d884c7e053c';
$name = 'SDK Example';
$description = 'My first SDK example';
// The reference name of a field is the key, and the value is the field value
$fields = array('age' => 42, 'name' => 'Alice');
$instance = $catalytic->instances->start($workflowId, $name, $description, $fields);
Updated about 3 years ago