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
Name | Type | Required | Description |
---|---|---|---|
createFolder | (folderName: string) => void | Yes | Creates a folder for organizing workflows. |
getFolders | () => string[] | Yes | Gets a list of workflow folders. |
createFlow | (folderName: string, flow: Flow) => void | Yes | Creates a workflow in the specified folder. |
getFlows | (folderName: string) => Flow[] | Yes | Gets 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
Name | Type | Required | Description |
---|---|---|---|
name | string | Yes | The 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
Name | Type | Required | Description |
---|---|---|---|
folderName | string | Yes | The name of a folder. |
flow | Flow | Yes | The 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
Name | Type | Required | Description |
---|---|---|---|
folderName | string | Yes | The 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
Name | Type | Required | Description |
---|---|---|---|
name | string | Yes | The name of the workflow. |
triggerType | string | Yes | ??? |
triggerConfiguration | string | Yes | ??? |
firstStepUniqueName | string | Yes | The uniqueName of the step that should run after the workflow is triggered. |
steps | FlowStep[] | Yes | The 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
Name | Type | Required | Description |
---|---|---|---|
uniqueName | string | Yes | The name of the step. This name must be unique. |
nextStepUniqueNames | string[] | Yes | The uniqueName of the steps that will run after the current step in the workflow. |
actionId | string | Yes | The GUID of the component. |
parameters | FlowStepParameter[] | Yes | The values of the step's parameters. |
position | StepPosition | Yes | The 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
Name | Type | Required | Description |
---|---|---|---|
x | number | Yes | The X coordinate of the workflow's step, in pixels. |
y | number | Yes | The 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
Name | Type | Required | Description |
---|---|---|---|
key | string | Yes | ??? |
expression | string | Yes | ??? |
Updated 9 months ago