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.

NameTypeDescription
IdGuidThe unique ID of the Workflow
NamestringThe descriptive name of the Workflow
DescriptionstringA description of what the Workflow does
CategorystringA descriptive grouping for your Workflow
InputFieldsFieldsCollectionA 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.

NameTypeDescription
IsPublishedboolIndicates whether the Workflow is published or is in draft mode
IsArchivedboolIndicates whether is Archived and no longer available for users
to find, start or edit.
FieldVisibilityFieldVisibilityThe default visibility level of fields for this Workflow
Public, Internal, Confidential or HighlyConfidential
InstanceVisibilityInstanceVisibilityThe visibility level of this Workflow
Open or Restricted
AdminUsersList<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_).
StandardUsersList<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.

NameTypeDescription
WorkflowIdGuidRead-only alias for Id.
ReferenceNamestringRead-only alias for Id, represented as a string. Used when
a Workflow is added to an ReferenceableCollection<T>
CreatedBystringThe email address of the user who created this Workflow
OwnerstringThe email address of the user who is the primary admin
for this Workflow. This user will receive fix tasks when there is
a 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)
ParameterTypeDescription
namestringThe name of the Workflow's input parameter
valueobjectThe value of the Workflow's input parameter
returnsStartInstanceRequestA 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}");
        }
    }
}