Skip to main content
Version: v5.2

IafWorkflowSvc

Use the IafWorkflowSvc API to manage workflows and their components, schedules, tasks, and permissions on the platform.

createJobTrigger

Creates a trigger for a workflow job

ParameterRequiredTypeDescription
workflowDefIdYesStringWorkflow definition ID
jobKeyYesStringJob Key
payloadYesObjectTrigger payload
ctxYesObjectContext object
Returns

Promise<Object> - Created trigger

Examples
const trigger = await IafWorkflowSvc.createJobTrigger('workflowDefId', 'jobKey', payload, ctx);

createPermissions

Creates workflow permissions

ParameterRequiredTypeDescription
permissionsYesArray<IafPermissionDescriptor>Permissions array
ctxYesObjectContext object
Returns

Promise<Object> - Permissions response

Examples
await IafWorkflowSvc.createPermissions([{ _resourceDesc: {} }], ctx);

createWorkflowDef

Creates a new Workflow definition

ParameterRequiredTypeDescription
workflowDefYesWorkflowDefWorkflow definition payload
ctxYesObjectContext object
Returns

Promise<WorkflowDef> - Created Workflow definition

Examples
const newDef = await IafWorkflowSvc.createWorkflowDef(workflowDef, ctx);

createWorkflowSchedule

Creates a workflow schedule

ParameterRequiredTypeDescription
workflowDefIdYesStringWorkflow definition ID
workflowScheduleYesObjectWorkflow schedule payload
ctxYesObjectContext object
Returns

Promise<Object> - Created workflow schedule

Examples
const schedule = await IafWorkflowSvc.createWorkflowSchedule(workflowDefId, payload, ctx);

deletePermission

Deletes a workflow permission by ID

ParameterRequiredTypeDescription
idYesStringPermission ID
ctxYesObjectContext object
Returns

Promise<Object> - Delete response

Examples
await IafWorkflowSvc.deletePermission('permId', ctx);

deleteWorkflowDef

Deletes a workflow definition

ParameterRequiredTypeDescription
workflowDefIdYesStringWorkflow definition ID
ctxYesObjectContext object
Returns

Promise<Object> - Delete response.

Examples
await IafWorkflowSvc.deleteWorkflowDef(workflowDefId, ctx);

deleteWorkflowJob

Deletes a workflow schedule job by jobKey

ParameterRequiredTypeDescription
workflowDefIdYesStringWorkflow definition ID
jobKeyYesStringJob Key
ctxYesObjectContext object
Returns

Promise<Object> - Delete response

Examples
await IafWorkflowSvc.deleteWorkflowJob('workflowDefId', 'jobKey', ctx);

deleteWorkflowScheduleJob

Deletes a workflow schedule job

ParameterRequiredTypeDescription
workflowDefIdYesStringWorkflow definition ID
jobIdYesStringJob ID
ctxYesObjectContext object
Returns

Promise<Object> - Delete response

Examples
await IafWorkflowSvc.deleteWorkflowScheduleJob('workflowDefId', 'jobId', ctx);

deleteWorkflowSchedules

Deletes all workflow schedules for a workflow definition

ParameterRequiredTypeDescription
workflowDefIdYesStringWorkflow definition ID
ctxYesObjectContext object
Returns

Promise<Object> - Delete response

Examples
await IafWorkflowSvc.deleteWorkflowSchedules('workflowDefId', ctx);

deleteWorkflowScheduleTrigger

Deletes a trigger for a workflow schedule

ParameterRequiredTypeDescription
workflowDefIdYesStringWorkflow definition ID
triggerIdYesStringTrigger ID
ctxYesObjectContext object
Returns

Promise<Object> - Delete response

Examples
await IafWorkflowSvc.deleteWorkflowScheduleTrigger('workflowDefId', 'triggerId', ctx);

deleteWorkflowTrigger

Deletes a workflow trigger by triggerKey

ParameterRequiredTypeDescription
workflowDefIdYesStringWorkflow definition ID
triggerKeyYesStringTrigger Key
ctxYesObjectContext object
Returns

Promise<Object> - Delete response

Examples
await IafWorkflowSvc.deleteWorkflowTrigger('workflowDefId', 'triggerKey', ctx);

getAllSchedules

Fetches all schedules (across all workflow definitions or for a specific workflow definition)

ParameterRequiredTypeDescription
workflowDefIdNo(String | UNKNOWN: NullLiteral)Workflow definition ID to filter schedules (optional)
ctxYesObjectContext object
optionsNoObjectOutput control options (e.g., _pageSize, _offset, sort)
Returns

Promise<Object> - All schedules

Examples
const schedules = await IafWorkflowSvc.getAllSchedules('workflowDefId', ctx, { _pageSize: 10 });
const allSchedules = await IafWorkflowSvc.getAllSchedules(null, ctx, { _pageSize: 20 });

getLoopOverTasks

Fetches loop-over tasks for a workflow.

ParameterRequiredTypeDescription
workflowIdYesStringWorkflow ID.
taskIdYesStringTask ID.
ctxYesObjectContext object.
criteriaNoObjectFilter criteria for loop-over tasks.
optionsNoObjectOutput control options (e.g., _pageSize, _offset, sort)
Returns

Promise<Array<TaskDef>> - Loop-over tasks.

Examples
const loops = await IafWorkflowSvc.getLoopOverTasks(
workflowId,
taskId,
ctx,
{ _name: 'TaskName' },
{ _pageSize: 10, _offset: 0, sort: { _createdAt: -1 } }
);

getPermissions

Gets workflow permissions based on your criteria

ParameterRequiredTypeDescription
criteriaYesPermissionCriteriaFilter criteria.
ctxYesObjectContext object.
Returns

Promise<Object> - Permissions.

Examples
const perms = await IafWorkflowSvc.getPermissions({ type: 'read' }, ctx);

getTaskById

Fetches a task by Workflow and Task IDs

ParameterRequiredTypeDescription
workflowIdYesStringWorkflow ID
taskIdYesStringTask ID
ctxYesObjectContext object
Returns

Promise<TaskDef> - The fetched Task

Examples
const task = await IafWorkflowSvc.getTaskById(workflowId, taskId, ctx);

getTaskDefById

Gets a task definition by ID (GET /workflowdefs/{workflowDefId}/taskdefs/{taskDefId})

ParameterRequiredTypeDescription
workflowDefIdYesStringWorkflow definition ID
taskDefIdYesStringTask definition ID
ctxYesObjectContext object
Returns

Promise<Object> - Task definition

Examples
const taskDef = await IafWorkflowSvc.getTaskDefById(workflowDefId, taskDefId, ctx);

getTaskDefs

Gets all task definitions for a workflow definition (GET /workflowdefs/{workflowDefId}/taskdefs)

ParameterRequiredTypeDescription
workflowDefIdYesStringWorkflow definition ID
ctxYesObjectContext object
criteriaNoObjectFilter criteria for task definitions
optionsNoObjectOutput control options (e.g., _pageSize, _offset, sort)
Returns

Promise<Object> - Task definitions

Examples
const taskDefs = await IafWorkflowSvc.getTaskDefs(
workflowDefId,
ctx,
{ _name: 'TaskName' },
{ _pageSize: 10, _offset: 0, sort: { _createdAt: -1 } }
);

getTaskLogsById

Fetches Task logs for a workflow.

ParameterRequiredTypeDescription
workflowIdYesStringWorkflow ID.
taskIdYesStringTask ID.
ctxYesObjectContext object.
criteriaNoObjectFilter criteria for logs.
optionsNoObjectOutput control options (e.g., _pageSize, _offset, sort)
Returns

Promise<Object> - Task logs.

Examples
const logs = await IafWorkflowSvc.getTaskLogsById(
workflowId,
taskId,
ctx,
{ _type: 'ERROR' },
{ _pageSize: 20, _offset: 0, sort: { _createdAt: -1 } }
);

getWorkflowComponents

Gets workflow components (GET /workflowdefs/components) with optional filtering and pagination

ParameterRequiredTypeDescription
ctxYesObjectContext object
nameNoStringOptional name filter for components
optionsNoObjectOutput control options (e.g., _pageSize, _offset)
Returns

Promise<Object> - Workflow components

Examples
const components = await IafWorkflowSvc.getWorkflowComponents(ctx, 'ComponentName', { _pageSize: 10, _offset: 0 });
const allComponents = await IafWorkflowSvc.getWorkflowComponents(ctx, null, { _pageSize: 20 });

getWorkflowDef

Fetches a workflow definition by ID

ParameterRequiredTypeDescription
workflowDefIdYesStringWorkflow definition ID
ctxYesObjectContext object
Returns

Promise<WorkflowDef> - Workflow definition

Examples
const def = await IafWorkflowSvc.getWorkflowDef(workflowDefId, ctx);

getWorkflowDefs

Fetches workflow definitions based the criteria you pass

ParameterRequiredTypeDescription
criteriaNoWorkflowDefCriteriaFilter criteria for workflows.
ctxYesObjectContext object
optionsNoWorkflowDefOptionsPagination control options.
Returns

Promise<Array<WorkflowDef>> - Workflow definitions.

Examples
const defs = await IafWorkflowSvc.getWorkflowDefs(
{ _name: 'Equipment-Commissioning' },
ctx,
{ _count: 10, _offset: 0 }
);

getWorkflowJob

Fetches a workflow schedule job by jobKey

ParameterRequiredTypeDescription
workflowDefIdYesStringWorkflow definition ID
jobKeyYesStringJob Key
ctxYesObjectContext object
Returns

Promise<Object> - Workflow schedule job

Examples
const job = await IafWorkflowSvc.getWorkflowJob('workflowDefId', 'jobKey', ctx);

getWorkflowJobTriggers

Fetches all triggers for a workflow schedule job, with optional pagination

ParameterRequiredTypeDescription
workflowDefIdYesStringWorkflow definition ID
jobKeyYesStringJob Key
ctxYesObjectContext object
optionsNoObjectOutput control options (e.g., _pageSize, _offset)
Returns

Promise<Object> - Triggers for the job

Examples
const triggers = await IafWorkflowSvc.getWorkflowJobTriggers('workflowDefId', 'jobKey', ctx, { _pageSize: 10, _offset: 0 });

getWorkflowParamsMap

Gets workflow parameter map (POST /workflowdefs/paramsMap)

ParameterRequiredTypeDescription
paramsYesObjectParameters object with clientId and clientSecret
ctxYesObjectContext object
Returns

Promise<Object> - Workflow params map

Examples
const paramsMap = await IafWorkflowSvc.getWorkflowParamsMap({ clientId, clientSecret }, ctx);

getWorkflows

Fetches workflows based on the criteria and options you pass

ParameterRequiredTypeDescription
criteriaNoObjectFilter criteria for workflows (e.g., _name, _defId, _status, startDate, endDate)
ctxYesObjectContext object
optionsNoObjectOutput control options (e.g., _pageSize, _offset, sort)
Returns

Promise<Array<Workflow>> - Workflows.

Examples
// Basic usage with name and status
const workflows = await IafWorkflowSvc.getWorkflows(
{ _name: 'MyWorkflow', _status: 'ACTIVE' },
ctx,
{ _pageSize: 10, _offset: 0, sort: { _createdAt: -1 } }
);
// Usage with _defId in criteria to filter by workflow definition
const filteredWorkflows = await IafWorkflowSvc.getWorkflows(
{ _defId: 'someDefId' },
ctx,
{ _pageSize: 5 }
);

getWorkflowScheduleJob

Fetches a workflow schedule job by ID

ParameterRequiredTypeDescription
workflowDefIdYesStringWorkflow definition ID
jobIdYesStringJob ID
ctxYesObjectContext object
Returns

Promise<Object> - Workflow schedule job

Examples
const job = await IafWorkflowSvc.getWorkflowScheduleJob('workflowDefId', 'jobId', ctx);

getWorkflowScheduleJobTriggers

Fetches all triggers for a workflow schedule job, with optional pagination

ParameterRequiredTypeDescription
workflowDefIdYesStringWorkflow definition ID
jobIdYesStringJob ID
ctxYesObjectContext object
optionsNoObjectOutput control options (e.g., _pageSize, _offset)
Returns

Promise<Object> - Triggers for the job

Examples
const triggers = await IafWorkflowSvc.getWorkflowScheduleJobTriggers('workflowDefId', 'jobId', ctx, { _pageSize: 10, _offset: 0 });

getWorkflowSchedules

Fetches all workflow schedules for a workflow definition, with optional pagination

ParameterRequiredTypeDescription
workflowDefIdYesStringWorkflow definition ID
ctxYesObjectContext object
optionsNoObjectOutput control options (e.g., _pageSize, _offset)
Returns

Promise<Object> - Workflow schedules

Examples
const schedules = await IafWorkflowSvc.getWorkflowSchedules('workflowDefId', ctx, { _pageSize: 10, _offset: 0 });

getWorkflowStatus

Gets workflow status by run ID

ParameterRequiredTypeDescription
runIdYesStringWorkflow run ID
ctxYesObjectContext object
Returns

Promise<Object> - Workflow status

Examples
const status = await IafWorkflowSvc.getWorkflowStatus(runId, ctx);

getWorkflowTriggers

Fetches all triggers for a workflow definition, with optional pagination

ParameterRequiredTypeDescription
workflowDefIdYesStringWorkflow definition ID
ctxYesObjectContext object
optionsNoObjectOutput control options (e.g., _pageSize, _offset)
Returns

Promise<Object> - Triggers for the workflow definition

Examples
const triggers = await IafWorkflowSvc.getWorkflowTriggers('workflowDefId', ctx, { _pageSize: 10, _offset: 0 });

runWorkflow

Runs a Workflow

ParameterRequiredTypeDescription
workflowDefIdYesStringWorkflow definition ID
paramsYesObjectInput parameters for the workflow
ctxYesObjectContext object
Returns

Promise<Object> - Run response

Examples
const params = { _workflowDefId: workflowDefId };
const result = await IafWorkflowSvc.runWorkflow(workflowDefId, params, ctx);

updatePermissions

Updates a Workflow's permissions

ParameterRequiredTypeDescription
permissionsYesArray<IafPermissionDescriptor>Permissions array
ctxYesObjectContext object
Returns

Promise<Object> - Update response

Examples
await IafWorkflowSvc.updatePermissions([{ _resourceDesc: {} }], ctx);

updateUserInput

Updates the user input for a workflow

ParameterRequiredTypeDescription
workflowIdYesStringWorkflow ID
userInputIdYesStringUser input ID
payloadYesObjectUser input payload
ctxYesObjectContext object
Returns

Promise<Object> - Updated response

Examples
await IafWorkflowSvc.updateUserInput(workflowId, userInputId, payload, ctx);

updateWorkflowDef

Updates an existing Workflow definition

ParameterRequiredTypeDescription
workflowDefIdYesStringWorkflow definition ID
workflowDefYesWorkflowDefUpdated workflow definition payload
ctxYesObjectContext object.
Returns

Promise<WorkflowDef> - Updated workflow definition

Examples
const updated = await IafWorkflowSvc.updateWorkflowDef(workflowDefId, workflowDef, ctx);

updateWorkflowStatus

Updates a workflow by run ID

ParameterRequiredTypeDescription
workflowRunIdYesStringWorkflow run ID
paramsYesWorkflowDefInput parameters for the workflow
ctxYesObjectContext object
Returns

Promise<Workflow> - Update response.

Examples
await IafWorkflowSvc.updateWorkflow('runId', ctx);