FlowManager

When a custom integration performs scaffolding, the run method receives a project.flowManager parameter:

function run(config, project, context) {
  console.log(project);
}

This parameter implements the FlowManager interface, which contains methods for creating and retrieving workflows.

Note: The FlowManager interface is, in many ways, similar to the DataTableManager interface.

Signature

interface FlowManager {
  createFolder(folderName: string): void;
  getFolders(): string[];
  createFlow(folderName: string, flow: Flow): void;
  getFlows(folderName: string): Flow[];
}

Properties

NameTypeRequiredDescription
createFolder(folderName: string) => voidYesCreates a folder for organizing workflows.
getFolders() => string[]YesGets a list of workflow folders.
createFlow(folderName: string, flow: Flow) => voidYesCreates a workflow in the specified folder.
getFlows(folderName: string) => Flow[]YesGets a list of workflows from the specified folder.

Methods

This section describes the methods that are available via the FlowManager interface.

createFolder

Creates a folder for organizing workflows.

Signature

createFolder(folderName: string): void;

Usage

function run(config, project, context) {
  project.flowManager.createFolder("Hello world");
}

Parameters

NameTypeRequiredDescription
namestringYesThe name of the folder.

Returns

void

getFolders

Gets a list of workflow folders.

Signature

getFolders(): string[];

Usage

function run(config, project, context) {
  project.flowManager.getFolders();
}

Parameters

This method doesn't have any parameters.

Returns

string[]

createFlow

Creates a workflow in the specified folder.

Signature

createFlow(folderName: string, flow: Flow): void;

Usage

function run(config, project, context) {
  project.flowManager.createFlow("Hello world", {});
}

Parameters

NameTypeRequiredDescription
folderNamestringYesThe name of a folder.
flowFlowYesThe configuration of the workflow.

Returns

void

getFlows

Gets a list of workflows from the specified folder.

Signature

getFlows(folderName: string): Flow[];

Usage

function run(config, project, context) {
  project.flowManager.getFlows("Hello world");
}

Parameters

NameTypeRequiredDescription
folderNamestringYesThe name of a folder.

Returns

Flow[]

Types

This section describes the types the FlowManager interface depend upon.

Flow

Represents the configuration of a workflow.

Signature

type Flow = {
  name: string;
  triggerType: "timer";
  triggerConfiguration: string;
  firstStepUniqueName: string;
  steps: FlowStep[];
};

Properties

NameTypeRequiredDescription
namestringYesThe name of the workflow.
triggerTypestringYes???
triggerConfigurationstringYes???
firstStepUniqueNamestringYesThe uniqueName of the step that should run after the workflow is triggered.
stepsFlowStep[]YesThe steps of the workflow.

FlowStep

Represents an individual step in a workflow.

Signature

type FlowStep = {
  uniqueName: string;
  nextStepUniqueNames: string[];
  actionId: string;
  parameters: FlowStepParameter[];
  position: StepPosition;
};

Properties

NameTypeRequiredDescription
uniqueNamestringYesThe name of the step. This name must be unique.
nextStepUniqueNamesstring[]YesThe uniqueName of the steps that will run after the current step in the workflow.
actionIdstringYesThe GUID of the component.
parametersFlowStepParameter[]YesThe values of the step's parameters.
positionStepPositionYesThe position of a workflow's step, as it appears in FL0's UI.

StepPosition

Represents the position of a workflow's step, as it appears in FL0's UI.

Signature

type StepPosition = {
  x: number;
  y: number;
};

Properties

NameTypeRequiredDescription
xnumberYesThe X coordinate of the workflow's step, in pixels.
ynumberYesThe Y coordinate of the workflow's step, in pixels.

FlowStepParameter

Represents the value of a parameter in a step of a workflow.

Signature

type FlowStepParameter = {
  key: string;
  expression: string;
};

Properties

NameTypeRequiredDescription
keystringYes???
expressionstringYes???