require(["esri/tasks/workflow/WorkflowTask"], function(WorkflowTask) { /* code goes here */ });
Class: esri/tasks/workflow/WorkflowTask
Inheritance: WorkflowTask Task Accessor
Since: ArcGIS API for JavaScript 4.3

Class to perform operations on Workflow Manager workflows and steps. The workflows are collections of steps that are executed while working on a job. Workflows are designed to organize and simplify tasks to ensure that no step is missed. The steps are the building blocks of your workflows and are connected using paths. Step and path properties determine the flow of the work.

Constructors

new WorkflowTask(properties)
Parameter:
properties Object
optional

See the properties for a list of all the properties that may be passed into the constructor.

Property Overview

Any properties can be set, retrieved or listened to. See the Working with Properties topic.
NameTypeSummaryClass
String

The name of the class.

more details
more detailsAccessor
Object

The options to be used for data requests.

more details
more detailsTask
String

URL to the ArcGIS Workflow Manager REST service.

more details
more detailsWorkflowTask

Property Details

declaredClassStringreadonly inherited
Since: ArcGIS API for JavaScript 4.7

The name of the class. The declared class name is formatted as esri.folder.className.

requestOptionsObject inherited

The options to be used for data requests. These options can also be controlled through the requestOptions method parameter.

URL to the ArcGIS Workflow Manager REST service.

Method Overview

NameReturn TypeSummaryClass
Promise<String>

Get the information which indicates whether this workflow step can be run.

more details
more detailsWorkflowTask
Promise<ExecuteInfo>

Executes the specified steps in order and gets back execution information of the steps.

more details
more detailsWorkflowTask
Promise<Step>

Gets all workflow steps of a job.

more details
more detailsWorkflowTask
Promise<Step>

Gets all current steps of a job.

more details
more detailsWorkflowTask
Promise<Step>

Gets a specific workflow step of a job.

more details
more detailsWorkflowTask
Promise<String>

Get the help associated with a workflow step.

more details
more detailsWorkflowTask
String

Gets a URL to access the file content of a file step.

more details
more detailsWorkflowTask
Promise<WorkflowDisplayDetails>

Get a job's workflow display details.

more details
more detailsWorkflowTask
String

Gets a URL of an image depicting the current state of a job's workflow.

more details
more detailsWorkflowTask
Promise<ExecuteInfo>

Marks the specified steps of a job workflow as completed.

more details
more detailsWorkflowTask
Promise<Boolean>

Advances the workflow to the next step based on a return code value.

more details
more detailsWorkflowTask
Promise<Boolean>

The job workflow is updated with the latest workflow of job type, after the job has been created.

more details
more detailsWorkflowTask
Promise<Boolean>

Resolves workflow path conflicts resulting from executing or marking as complete a step, which can have two or more next steps.

more details
more detailsWorkflowTask
Promise<Boolean>

Sets a step as the current active step of a job workflow.

more details
more detailsWorkflowTask

Method Details

canRunStep(params, requestOptions){Promise<String>}

Get the information which indicates whether this workflow step can be run.

Parameters:
params Object

See the object specifications in table below for the structure of the params object.

Specification:
jobId Number

The unique id of the job.

stepId Number

The unique id of the step.

user String

The user name of the user wanting to run the step.

requestOptions Object
optional

Additional options to be used for the data request (will override requestOptions defined during construction).

Returns:
TypeDescription
Promise<String>When resolved, returns information on whether the step can be run. Possible Values: can-run | dependent-on-step | dependent-on-stage | dependent-on-status | job-on-hold | step-depends-on-step | step-assigned-to-other-user | step-assigned-to-other-group | job-assigned-to-others | job-closed | invalid-platform | invalid-step | dependent-on-job | not-current-step
executeSteps(params, requestOptions){Promise<ExecuteInfo>}

Executes the specified steps in order and gets back execution information of the steps.

Parameters:
params Object

See the object specifications in table below for the structure of the params object.

Specification:
jobId Number

The unique id of the job.

stepIds Number[]

The array of unique step Ids.

auto Boolean

Indicates whether to automatically execute as many steps as possible, based on the workflow configuration. The default is false, to execute only the current step.

user String

The user name of the user executing the step.

requestOptions Object
optional

Additional options to be used for the data request (will override requestOptions defined during construction).

Returns:
TypeDescription
Promise<ExecuteInfo>When resolved, returns execution information for the steps that were executed.
Example:
var params = {
  jobId: 1501,
  stepIds: [17682, 17683],
  auto: true,
  user: "cjones"
};
workflowTask.executeSteps(params).then(function(data){
  var executeInfoArray = data;
  . . .
});
getAllSteps(jobId, requestOptions){Promise<Step>}

Gets all workflow steps of a job.

Parameters:
jobId Number

The unique id of the job.

requestOptions Object
optional

Additional options to be used for the data request (will override requestOptions defined during construction).

Returns:
TypeDescription
Promise<Step>When resolved, returns an array of all workflow steps of a job.
getCurrentSteps(jobId, requestOptions){Promise<Step>}

Gets all current steps of a job. A workflow will have more than one current step if it is configured to support parallel steps.

Parameters:
jobId Number

The unique id of the job.

requestOptions Object
optional

Additional options to be used for the data request (will override requestOptions defined during construction).

Returns:
TypeDescription
Promise<Step>When resolved, returns an array of all current steps of a job.
getStep(params, requestOptions){Promise<Step>}

Gets a specific workflow step of a job.

Parameters:
params Object

See the object specifications in table below for the structure of the params object.

Specification:
jobId Number

The unique id of the job.

stepId Number

The unique id of the step.

requestOptions Object
optional

Additional options to be used for the data request (will override requestOptions defined during construction).

Returns:
TypeDescription
Promise<Step>When resolved, returns a specific workflow step of a job.
getStepDescription(params, requestOptions){Promise<String>}

Get the help associated with a workflow step.

Parameters:
params Object

See the object specifications in table below for the structure of the params object.

Specification:
jobId Number

The unique id of the job.

stepId Number

The unique id of the step.

requestOptions Object
optional

Additional options to be used for the data request (will override requestOptions defined during construction).

Returns:
TypeDescription
Promise<String>When resolved, returns the help associated with a workflow step as string.
getStepFileUrl(params){String}

Gets a URL to access the file content of a file step.

Parameters:
params Object

See the object specifications in table below for the structure of the params object.

Specification:
jobId Number

The unique id of the job.

stepId Number

The unique id of the step.

Returns:
TypeDescription
StringReturns a URL to access the file content of a file step as string.
getWorkflowDisplayDetails(jobId, requestOptions){Promise<WorkflowDisplayDetails>}
Parameters:
jobId Number

The unique id of the job.

requestOptions Object
optional

Additional options to be used for the data request (will override requestOptions defined during construction).

Returns:
TypeDescription
Promise<WorkflowDisplayDetails>When resolved, returns jobs workflow display details.
getWorkflowImageUrl(jobId){String}

Gets a URL of an image depicting the current state of a job's workflow.

Parameter:
jobId Number

The unique id of the job.

Returns:
TypeDescription
StringReturns the URL of an image depicting the current state of a job's workflow as a string.
markStepsAsDone(params, requestOptions){Promise<ExecuteInfo>}

Marks the specified steps of a job workflow as completed.

Parameters:
params Object

See the object specifications in table below for the structure of the params object.

Specification:
jobId Number

The unique id of the job.

stepIds Number[]

The array of unique step Ids.

user String

The user name of the user marking the step complete.

requestOptions Object
optional

Additional options to be used for the data request (will override requestOptions defined during construction).

Returns:
TypeDescription
Promise<ExecuteInfo>When resolved, returns execution information for the steps.
moveToNextStep(params, requestOptions){Promise<Boolean>}

Advances the workflow to the next step based on a return code value.

Parameters:
params Object

See the object specifications in table below for the structure of the params object.

Specification:
jobId Number

The unique id of the job Id.

stepId Number

The unique id of the step.

returnCode Number

A numeric value representing the return code.

user String

The user name of the user advancing the workflow to the next step.

requestOptions Object
optional

Additional options to be used for the data request (will override requestOptions defined during construction).

Returns:
TypeDescription
Promise<Boolean>When resolved, returns boolean that indicates if the request succeeded or not.
Example:
var params = {
  jobId: 1501,
  stepId: 1534,
  returnCode: 3,
  user: "cjones"
};
workflowTask.moveToNextStep(params).then(function(){
  console.log("Moved to next step complete.")
}, function() {
  console.log("Failed to move to next step.")
});
recreateWorkflow(params, requestOptions){Promise<Boolean>}

The job workflow is updated with the latest workflow of job type, after the job has been created.

Parameters:
params Object

See the object specifications in table below for the structure of the params object.

Specification:
jobId Number

The unique id of the job.

user String

The user name of the user recreating the workflow.

requestOptions Object
optional

Additional options to be used for the data request (will override requestOptions defined during construction).

Returns:
TypeDescription
Promise<Boolean>When resolved, returns boolean that indicates if the request succeeded or not.
resolveConflict(params, requestOptions){Promise<Boolean>}

Resolves workflow path conflicts resulting from executing or marking as complete a step, which can have two or more next steps.

Parameters:
params Object

See the object specifications in table below for the structure of the params object.

Specification:
jobId Number

The unique id of the job.

stepId Number

The unique id of the step.

optionReturnCode Number

A numeric value representing the return code from the step where the conflict was encountered.

optionStepIds Number[]

An array of unique step IDs of all the possible next steps.

user String

The user name of the user resolving the conflict.

requestOptions Object
optional

Additional options to be used for the data request (will override requestOptions defined during construction).

Returns:
TypeDescription
Promise<Boolean>When resolved, returns boolean that indicates if the request succeeded or not.
Example:
var params = {
  jobId: 6833,
  stepId: 6967,
  optionReturnCode: 2,
  optionStepIds: [6964,6965],
  user: "demo"
};
workflowTask.resolveConflict(params).then(function(){
  console.log("Successfully resolved conflict.")
}, function() {
  console.log("Failed to resolve conflict.")
});
setCurrentStep(params, requestOptions){Promise<Boolean>}

Sets a step as the current active step of a job workflow.

Parameters:
params Object

See the object specifications in table below for the structure of the params object.

Specification:
jobId Number

The unique id of the job.

stepId Number

The unique id of the step.

user String

The user name of the user setting the current step.

requestOptions Object
optional

Additional options to be used for the data request (will override requestOptions defined during construction).

Returns:
TypeDescription
Promise<Boolean>When resolved, returns boolean that indicates if the request succeeded or not.

Type Definitions

ExecuteInfoObject

ExecuteInfo provides information on whether a step can be executed.

Properties:

Information about conflicts in workflow step progression.

errorCode Number

The error code returned by the steps in the workflow.

errorDescription String

The description for the errors returned by the steps in the workflow.

executionResult String

The result of a step execution.

Possible Values: executed | dependent-on-step | dependent-on-stage | dependent-on-status | job-on-hold | step-depends-on-step | check | step-assigned-to-other-user | step-assigned-to-other-group | job-assigned-to-others | job-closed | invalid-platform | invalid-step | dependent-on-job | not-current-step

hasConflicts Boolean

Indicates whether a step has conflicts.

hasReturnCode Boolean

Indicates whether a step has return code.

jobID Number

The unique id of current job.

returnCode Number

The return code for the current workflow step.

stepID Number

The unique id of the current step in the workflow.

threwError Boolean

Indicates whether the step threw an error during execution.

StepObject

Step represents the properties of a step that is used in a job's workflow.

Properties:
assignedTo String

The user or group to whom the step is assigned.

assignedType String

Indicates whether the job is assigned to a user, group or unassigned.

Possible Values: none | unassigned | user | group

async Boolean

Indicates whether the step can be run asynchronously.

autoRun Boolean

Indicates whether the step can be automatically executed when reached.

canSkip Boolean

Indicates whether the step can be skipped without executing it.

canSpawnConcurrency Boolean

Indicates whether the step can start parallel execution of other steps.

commonId Number

The unique id of step type.

defaultPercentComplete Number

The default percentage completion of the job once step is reached.

hasBeenExecuted Boolean

Indicates whether the step has already been executed.

hasBeenStarted Boolean

Indicates whether the step has been started.

The unique id generated as the step Id.

name String

The name of the step.

selfCheck Boolean

Indicates whether the step will be automatically marked as complete when complete.

statusId Number

The unique numeric status value configured as the status of the job once step is reached.

stepPercentComplete Number

The percentage completion of the step.

notificationType String

The type of notification that will be sent when the step finishes execution.

stepType StepType

The step template for current step.

StepTypeObject

StepType represents properties of step templates that are available in the Workflow Manager system for authoring workflows.

Properties:
arguments String

The step arguments required at runtime.

description String

The description of the step type.

executionType String

The type of execution for the step.

Possible Values: executable | function | procedural | launch-url | question | open-file

The unique id for the step type.

name String

The name of the step type.

program String

The program/application/code that will be executed on this step.

stepDescriptionLink String

The path/URL of the step description.

stepDescriptionType String

The type of step description.

Possible Values: none | embedded-html | link

stepIndicatorType String

The shape of the step as it will appear in a workflow graphic.

Possible Values: rounded-rectangle | rectangle | oval | diamond | parallelogram

supportedPlatform String

The platform on which the step can be executed.

Possible Values: desktop | server | both

visible Boolean

Indicates whether Workflow Manager will be minimized and hidden during step execution.

WorkflowAnnotationDisplayDetailsObject

WorkflowAnnotationDisplayDetails represents properties of a workflow annotation.

Properties:
centerX Number

The X coordinate of the annotation object.

centerY Number

The Y coordinate of the annotation object.

fillColor dojo.color

The fill color of the annotation object.

height Number

The height of the annotation.

label String

The annotation text.

labelColor dojo.color

The color of annotation label text.

OutlineColor dojo.color

The outline color.

width Number

The width of the annotation.

WorkflowConflictsObject

WorkflowConflicts represents properties for workflows that have a conflicting path or multiple possible paths for progression.

Properties:
jobID Number

The unique id of currently active job.

The information about the step in the workflow returned as WorkflowOption.

spawnsConcurrency Boolean

Indicates whether the step will begin a concurrent path in the workflow.

stepId Number

The unique id of the step.

WorkflowDisplayDetailsObject

WorkflowDisplayDetails represents a collection of properties that constitute a workflow - annotations, steps, and paths.

Properties:

The properties of how the annotations are displayed.

The properties of how the path are displayed.

The properties of how the step are displayed.

WorkflowOptionObject

WorkflowOption represents properties of a workflow that have return codes and step branches.

Properties:
returnCode Number

The return code generated from a step execution.

The collection of descriptions for workflow steps.

WorkflowPathDisplayDetailsObject

WorkflowPathDisplayDetails represents properties of a workflow's path properties like location, destination steps, position on the workflow canvas.

Properties:
destStepId Number

The unique id of the step to which the path will lead.

sourceStepID Number

The unique id of the step just executed.

label String

The label associated with the path.

labelColor dojo.color

The color of the label on the path.

labelX Number

The X coordinate of the label.

labelY Number

The Y coordinate of the label.

lineColor dojo.color

The color of the line representing the path.

pathObject Object

An object with following properties.

NameTypeDescription
isDefaultBooleanIndicates whether this is the default path(only path) from the source step.
numReturnValuesNumber[]The number of possible return values for the path.
returnValueXNumber[]The return values associated with the path.
WorkflowStepDisplayDetailsObject

WorkflowStepDisplayDetails represents properties of a workflow step.

Properties:
centerX Number

The X coordinate of the step.

centerY Number

The Y coordinate of the step.

fillColor dojo.color

The fill color of the step.

height Number

The height of the step.

label String

The step text.

labelColor dojo.color

The color of step label text.

OutlineColor dojo.color

The outline color.

shape String

The shape of the step.

Possible Values: rounded-rectangle | rectangle | oval | diamond | parallelogram

stepId Number

The unique id of the step.

stepType String

The step execution type.

Possible Values: executable | function | procedural | launch-url | question | open-file

width Number

The width of the annotation.

WorkflowStepInfoObject

WorkflowStepInfo represents collection of descriptions for workflow's steps.

Properties:

The unique id of the step.

name String

The name of the step.

API Reference search results

NameTypeModule
Loading...