WorkflowTask
require(["esri/tasks/workflow/WorkflowTask"], function(WorkflowTask) { /* code goes here */ });
esri/tasks/workflow/WorkflowTask
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.
- Steps - The steps determine how the work will be done, for example a geoprocessing tool will be executed to buffer the points. Get information about a step, and whether a step can be run. You can get all steps in the workflow, or the current steps for execution. The steps can be executed or marked as done when executing a job. The steps can also be set as the current step of workflow and the workflow can be advanced to the next step when the current step is done.
- Workflows - The workflow consists of steps, paths and annotations. Details about the steps, path and the annotation can be retrieved and the workflow can be retrieved as an image as well.
Constructors
- new WorkflowTask(properties)
- Parameter:properties Objectoptional
See the properties for a list of all the properties that may be passed into the constructor.
Property Overview
Name | Type | Summary | Class | |
---|---|---|---|---|
String | The name of the class. more details | more details | Accessor | |
Object | The options to be used for data requests. more details | more details | Task | |
String | URL to the ArcGIS Workflow Manager REST service. more details | more details | WorkflowTask |
Property Details
- Since: ArcGIS API for JavaScript 4.7
The name of the class. The declared class name is formatted as
esri.folder.className
.
The options to be used for data requests. These options can also be controlled through the
requestOptions
method parameter.
- urlString
URL to the ArcGIS Workflow Manager REST service.
Method Overview
Name | Return Type | Summary | Class | |
---|---|---|---|---|
Promise<String> | Get the information which indicates whether this workflow step can be run. more details | more details | WorkflowTask | |
Promise<ExecuteInfo> | Executes the specified steps in order and gets back execution information of the steps. more details | more details | WorkflowTask | |
Promise<Step> | Gets all workflow steps of a job. more details | more details | WorkflowTask | |
Promise<Step> | Gets all current steps of a job. more details | more details | WorkflowTask | |
Promise<Step> | Gets a specific workflow step of a job. more details | more details | WorkflowTask | |
Promise<String> | Get the help associated with a workflow step. more details | more details | WorkflowTask | |
String | Gets a URL to access the file content of a file step. more details | more details | WorkflowTask | |
Promise<WorkflowDisplayDetails> | Get a job's workflow display details. more details | more details | WorkflowTask | |
String | Gets a URL of an image depicting the current state of a job's workflow. more details | more details | WorkflowTask | |
Promise<ExecuteInfo> | Marks the specified steps of a job workflow as completed. more details | more details | WorkflowTask | |
Promise<Boolean> | Advances the workflow to the next step based on a return code value. more details | more details | WorkflowTask | |
Promise<Boolean> | The job workflow is updated with the latest workflow of job type, after the job has been created. more details | more details | WorkflowTask | |
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 details | WorkflowTask | |
Promise<Boolean> | Sets a step as the current active step of a job workflow. more details | more details | WorkflowTask |
Method Details
Get the information which indicates whether this workflow step can be run.
Parameters:params ObjectSee the object specifications in table below for the structure of the
params
object.Specification:jobId NumberThe unique id of the job.
stepId NumberThe unique id of the step.
user StringThe user name of the user wanting to run the step.
requestOptions ObjectoptionalAdditional options to be used for the data request (will override requestOptions defined during construction).
Returns:Type Description 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 ObjectSee the object specifications in table below for the structure of the
params
object.Specification:jobId NumberThe unique id of the job.
stepIds Number[]The array of unique step Ids.
auto BooleanIndicates 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 StringThe user name of the user executing the step.
requestOptions ObjectoptionalAdditional options to be used for the data request (will override requestOptions defined during construction).
Returns:Type Description 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; . . . });
Gets all workflow steps of a job.
Parameters:jobId NumberThe unique id of the job.
requestOptions ObjectoptionalAdditional options to be used for the data request (will override requestOptions defined during construction).
Returns:Type Description Promise<Step> When resolved, returns an array of all workflow steps of a job.
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 NumberThe unique id of the job.
requestOptions ObjectoptionalAdditional options to be used for the data request (will override requestOptions defined during construction).
Returns:Type Description Promise<Step> When resolved, returns an array of all current steps of a job.
Gets a specific workflow step of a job.
Parameters:params ObjectSee the object specifications in table below for the structure of the
params
object.Specification:jobId NumberThe unique id of the job.
stepId NumberThe unique id of the step.
requestOptions ObjectoptionalAdditional options to be used for the data request (will override requestOptions defined during construction).
Returns:Type Description Promise<Step> When resolved, returns a specific workflow step of a job.
Get the help associated with a workflow step.
Parameters:params ObjectSee the object specifications in table below for the structure of the
params
object.Specification:jobId NumberThe unique id of the job.
stepId NumberThe unique id of the step.
requestOptions ObjectoptionalAdditional options to be used for the data request (will override requestOptions defined during construction).
Returns:Type Description 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 ObjectSee the object specifications in table below for the structure of the
params
object.Specification:jobId NumberThe unique id of the job.
stepId NumberThe unique id of the step.
Returns:Type Description String Returns a URL to access the file content of a file step as string.
- getWorkflowDisplayDetails(jobId, requestOptions){Promise<WorkflowDisplayDetails>}
Get a job's workflow display details.
Parameters:jobId NumberThe unique id of the job.
requestOptions ObjectoptionalAdditional options to be used for the data request (will override requestOptions defined during construction).
Returns:Type Description 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 NumberThe unique id of the job.
Returns:Type Description String Returns 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 ObjectSee the object specifications in table below for the structure of the
params
object.Specification:jobId NumberThe unique id of the job.
stepIds Number[]The array of unique step Ids.
user StringThe user name of the user marking the step complete.
requestOptions ObjectoptionalAdditional options to be used for the data request (will override requestOptions defined during construction).
Returns:Type Description Promise<ExecuteInfo> When resolved, returns execution information for the steps.
Advances the workflow to the next step based on a return code value.
Parameters:params ObjectSee the object specifications in table below for the structure of the
params
object.Specification:jobId NumberThe unique id of the job Id.
stepId NumberThe unique id of the step.
returnCode NumberA numeric value representing the return code.
user StringThe user name of the user advancing the workflow to the next step.
requestOptions ObjectoptionalAdditional options to be used for the data request (will override requestOptions defined during construction).
Returns:Type Description 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.") });
The job workflow is updated with the latest workflow of job type, after the job has been created.
Parameters:params ObjectSee the object specifications in table below for the structure of the
params
object.Specification:jobId NumberThe unique id of the job.
user StringThe user name of the user recreating the workflow.
requestOptions ObjectoptionalAdditional options to be used for the data request (will override requestOptions defined during construction).
Returns:Type Description Promise<Boolean> When resolved, returns boolean that indicates if the request succeeded or not.
Resolves workflow path conflicts resulting from executing or marking as complete a step, which can have two or more next steps.
Parameters:params ObjectSee the object specifications in table below for the structure of the
params
object.Specification:jobId NumberThe unique id of the job.
stepId NumberThe unique id of the step.
optionReturnCode NumberA 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 StringThe user name of the user resolving the conflict.
requestOptions ObjectoptionalAdditional options to be used for the data request (will override requestOptions defined during construction).
Returns:Type Description 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.") });
Sets a step as the current active step of a job workflow.
Parameters:params ObjectSee the object specifications in table below for the structure of the
params
object.Specification:jobId NumberThe unique id of the job.
stepId NumberThe unique id of the step.
user StringThe user name of the user setting the current step.
requestOptions ObjectoptionalAdditional options to be used for the data request (will override requestOptions defined during construction).
Returns:Type Description 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:
- conflicts WorkflowConflicts
Information about conflicts in workflow step progression.
errorCode NumberThe error code returned by the steps in the workflow.
errorDescription StringThe description for the errors returned by the steps in the workflow.
executionResult StringThe 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 BooleanIndicates whether a step has conflicts.
hasReturnCode BooleanIndicates whether a step has return code.
jobID NumberThe unique id of current job.
returnCode NumberThe return code for the current workflow step.
stepID NumberThe unique id of the current step in the workflow.
threwError BooleanIndicates 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 StringIndicates whether the job is assigned to a user, group or unassigned.
Possible Values: none | unassigned | user | group
async BooleanIndicates whether the step can be run asynchronously.
autoRun BooleanIndicates whether the step can be automatically executed when reached.
canSkip BooleanIndicates whether the step can be skipped without executing it.
canSpawnConcurrency BooleanIndicates whether the step can start parallel execution of other steps.
commonId NumberThe unique id of step type.
defaultPercentComplete NumberThe default percentage completion of the job once step is reached.
hasBeenExecuted BooleanIndicates whether the step has already been executed.
hasBeenStarted BooleanIndicates whether the step has been started.
id NumberThe unique id generated as the step Id.
name StringThe name of the step.
selfCheck BooleanIndicates whether the step will be automatically marked as complete when complete.
statusId NumberThe unique numeric status value configured as the status of the job once step is reached.
stepPercentComplete NumberThe percentage completion of the step.
notificationType StringThe type of notification that will be sent when the step finishes execution.
stepType StepTypeThe 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 StringThe description of the step type.
executionType StringThe type of execution for the step.
Possible Values: executable | function | procedural | launch-url | question | open-file
id NumberThe unique id for the step type.
name StringThe name of the step type.
program StringThe program/application/code that will be executed on this step.
stepDescriptionLink StringThe path/URL of the step description.
stepDescriptionType StringThe type of step description.
Possible Values: none | embedded-html | link
stepIndicatorType StringThe shape of the step as it will appear in a workflow graphic.
Possible Values: rounded-rectangle | rectangle | oval | diamond | parallelogram
supportedPlatform StringThe platform on which the step can be executed.
Possible Values: desktop | server | both
visible BooleanIndicates 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 NumberThe Y coordinate of the annotation object.
fillColor dojo.colorThe fill color of the annotation object.
height NumberThe height of the annotation.
label StringThe annotation text.
labelColor dojo.colorThe color of annotation label text.
OutlineColor dojo.colorThe outline color.
width NumberThe 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.
options WorkflowOption[]The information about the step in the workflow returned as WorkflowOption.
spawnsConcurrency BooleanIndicates whether the step will begin a concurrent path in the workflow.
stepId NumberThe unique id of the step.
- WorkflowDisplayDetailsObject
WorkflowDisplayDetails represents a collection of properties that constitute a workflow - annotations, steps, and paths.
- Properties:
- annotations WorkflowAnnotationDisplayDetails[]
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.
steps WorkflowStepInfo[]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 NumberThe unique id of the step just executed.
label StringThe label associated with the path.
labelColor dojo.colorThe color of the label on the path.
labelX NumberThe X coordinate of the label.
labelY NumberThe Y coordinate of the label.
lineColor dojo.colorThe color of the line representing the path.
pathObject ObjectAn object with following properties.
Name Type Description isDefault Boolean Indicates whether this is the default path(only path) from the source step. numReturnValues Number[] The number of possible return values for the path. returnValueX Number[] 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 NumberThe Y coordinate of the step.
fillColor dojo.colorThe fill color of the step.
height NumberThe height of the step.
label StringThe step text.
labelColor dojo.colorThe color of step label text.
OutlineColor dojo.colorThe outline color.
shape StringThe shape of the step.
Possible Values: rounded-rectangle | rectangle | oval | diamond | parallelogram
stepId NumberThe unique id of the step.
stepType StringThe step execution type.
Possible Values: executable | function | procedural | launch-url | question | open-file
width NumberThe width of the annotation.