The Workflow Entity
Workflow
Catalytic.SDK.Entities.Workflow
The Workflow
class represents a Catalytic Workflow and can be used to start a new Instance
of a workflow.
Summary of Properties and Methods
Common Instance Properties
These are the most commonly used properties of a Workflow
.
Name | Type | Description |
---|---|---|
Id | Guid | The unique ID of the Workflow |
Name | string | The descriptive name of the Workflow |
Description | string | A description of what the Workflow does |
Category | string | A descriptive grouping for your Workflow |
InputFields | FieldsCollection | A collection of the required and optional input fields that can be passed to this Workflow when starting it. |
Permission and Visibility Instance Properties
These are the properties that determine how users can find, edit, start or access a Workflow
.
Name | Type | Description |
---|---|---|
IsPublished | bool | Indicates whether the Workflow is published or is in draft mode |
IsArchived | bool | Indicates whether is Archived and no longer available for users to find, start or edit. |
FieldVisibility | FieldVisibility | The default visibility level of fields for this WorkflowPublic , Internal , Confidential or HighlyConfidential |
InstanceVisibility | InstanceVisibility | The visibility level of this WorkflowOpen or Restricted |
AdminUsers | List<string> | The users or groups who who may view, start, and edit this Workflow . Users will be represented by their Email ,groups by their group name (starting with g_ ). |
StandardUsers | List<string> | The users or groups who who may view and start this Workflow . Users will be represented by their Email ,groups by their group name (starting with g_ ). |
Other Instance Properties
These are less commonly used properties, or properties that are often used only with specific interfaces.
Name | Type | Description |
---|---|---|
WorkflowId | Guid | Read-only alias for Id . |
ReferenceName | string | Read-only alias for Id , represented as a string . Used when a Workflow is added to an ReferenceableCollection<T> |
CreatedBy | string | The email address of the user who created this Workflow |
Owner | string | The email address of the user who is the primary admin for this Workflow . This user will receive fix tasks when there isa problem in an Instance of this Workflow |
Constructors
Workflow
instances should not be created directly via the constructor. Instead they should be created in the Web UI. Future versions will support creating new Workflows via the SDK.
Methods
The SetInput Instance Method
Supports setting inputs in a chaining style and then passing those to an Instances.Start()
call to start an Instance
of this Workflow
with the specified inputs.
Method Signature
StartInstanceRequest SetInput(string name, object value)
Parameter | Type | Description |
---|---|---|
name | string | The name of the Workflow's input parameter |
value | object | The value of the Workflow's input parameter |
returns | StartInstanceRequest | A request that can be passed to Instances.Start() |
Example
/*
* This example demonstrates starting a Workflow with inputs
*/
using Catalytic.Sdk;
using Catalytic.Sdk.Entities;
using System;
namespace Catalytic.Sdk.Examples
{
class Program
{
static void Main(string[] args)
{
var catalytic = new Catalytic.Sdk.CatalyticClient(Credentials.Default);
var workflow = catalytic.Workflows.Get("c9f2beec-10c0-4f2f-b4e0-1d884c7e053c");
// Set the inputs to the workflow
var request = workflow
.SetInput("Age", 42)
.SetInput("Name", "Alice")
.SetName($"SDK Example - {DateTimeOffset.Now.ToString()}");
// Start the workflow
var instance = catalytic.Instances.Start(request);
var instanceUrl = $"https://{catalytic.Credentials.Domain}/runs/{instance.Id}";
Console.WriteLine(
"Workflow started successfully." +
$"View your Workflow at ${instanceUrl}");
}
}
}
The SetInputs Instance Method
This method supports setting multiple inputs with a Dictionary
of input names and values and then passing those to an catalytic.Instances.Start()
call to start an Instance
of this Workflow
with the specified inputs. This can be a better fit than the chainable SetInput()
when you don't know the set of inputs at compile time but instead want to build them up in a dictionary dynamically.
Method Signature
StartInstanceRequest SetInputs(IEnumerable<KeyValuePair<string, object>> inputs = null)
Example
/*
* This example demonstrates starting a Workflow with inputs
*/
using Catalytic.Sdk;
using Catalytic.Sdk.Entities;
using System;
namespace Catalytic.Sdk.Examples
{
class Program
{
static void Main(string[] args)
{
var catalytic = new Catalytic.Sdk.CatalyticClient(Credentials.Default);
var workflow = catalytic.Workflows.Get("c9f2beec-10c0-4f2f-b4e0-1d884c7e053c");
// Set the inputs to the workflow
var inputs = new Dictionary<string, object>()
{
["Name"] = "Alice",
["Age"] = 42,
};
var request = workflow.SetInputs
.SetInputs(inputs)
.SetName($"SDK Example - {DateTimeOffset.Now.ToString()}");
// Start the workflow
var instance = catalytic.Instances.Start(request);
var instanceUrl = $"https://{catalytic.Credentials.Domain}/runs/{instance.Id}";
Console.WriteLine(
"Workflow started successfully." +
$"View your Workflow at ${instanceUrl}");
}
}
}
Updated about 4 years ago