Skip to main content
Version: v5.0

IafWorkflowSvc

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

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);

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);

getLoopOverTasks#

Fetches loop-over tasks for a workflow.

ParameterRequiredTypeDescription
workflowIdYesStringWorkflow ID.
taskIdYesStringTask ID.
ctxYesObjectContext object.
criteriaYesObjectFilter criteria.
Returns

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

Examples
const loops = await IafWorkflowSvc.getLoopOverTasks(workflowId, taskId, ctx, { count: 10 });

getPermissions#

Gets workflow permissions based on your criteria

ParameterRequiredTypeDescription
criteriaYesObjectFilter 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);

getWorkflowComponents#

Fetches Workflow components with formal parameters

ParameterRequiredTypeDescription
ctxYesObjectContext object.
Returns

Promise<Object> - Workflow components response

Examples
await IafWorkflowSvc.getWorkflowComponents(workflowDefId, ctx);

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
criteriaYesObjectFilter criteria for workflows
ctxYesObjectContext object
optionsNoObjectAdditional control options
Returns

Promise<Array<WorkflowDef>> - Workflow definitions.

Examples
const defs = await IafWorkflowSvc.getWorkflowDefs({ count: 10 }, ctx);

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

ParameterRequiredTypeDescription
workflowDefIdYesStringWorkflow definition ID
jobIdYesStringJob ID
ctxYesObjectContext object
Returns

Promise<Object> - Triggers for the job

Examples
const triggers = await IafWorkflowSvc.getWorkflowScheduleJobTriggers('workflowDefId', 'jobId', ctx);

getWorkflowSchedules#

Fetches all workflow schedules for a workflow definition

ParameterRequiredTypeDescription
workflowDefIdYesStringWorkflow definition ID
ctxYesObjectContext object
Returns

Promise<Object> - Workflow schedules

Examples
const schedules = await IafWorkflowSvc.getWorkflowSchedules('workflowDefId', ctx);

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

ParameterRequiredTypeDescription
workflowDefIdYesStringWorkflow definition ID
ctxYesObjectContext object
Returns

Promise<Object> - Triggers for the workflow definition

Examples
const triggers = await IafWorkflowSvc.getWorkflowTriggers('workflowDefId', ctx);

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<WorkflowDef> - Update response.

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