Skip to content
import Workflow from "@arcgis/core/widgets/Editor/Workflow.js";
Inheritance:
WorkflowAccessor
Subclasses:
CreateFeaturesWorkflow, MergeFeaturesWorkflow, SplitFeatureWorkflow, UpdateFeaturesWorkflow, UpdateWorkflow
Since
ArcGIS Maps SDK for JavaScript 4.11

The read-only Workflow class helps manage different stages of an editing workflow. A workflow can be thought of as one of two types: CreateFeaturesWorkflow and UpdateWorkflow. If adding an individual or multiple features, the CreateFeaturesWorkflow is used. Whereas if editing an existing feature, the UpdateWorkflow is used. Updating workflows include both editing geometry and attribute data and deleting features.

An instance of either a CreateFeaturesWorkflow or UpdateWorkflow is accessed via the activeWorkflow property in either the Editor.activeWorkflow or EditorViewModel.activeWorkflow classes.

These workflows are only enabled if the feature service allows these operations. For example, if a feature service is only enabled to allow updates, it is not possible to override this using the API.

See also

Constructors

Constructor

Constructor
Parameters
ParameterTypeDescriptionRequired
properties
See the properties table for a list of all the properties that may be passed into the constructor.

Properties

Any properties can be set, retrieved or listened to. See the Watch for changes topic.
PropertyTypeClass
data
readonly
D
declaredClass
readonly inherited
hasNextStep
readonly
hasPreviousStep
readonly
started
readonly
stepId
readonly
S
type
readonly
"add-association" | "create-features" | "merge-features" | "split-feature" | "update" | "update-feature" | "update-features" | "update-table-record"

data

readonly Property
Type
D

declaredClass

readonlyinherited Property
Type
string
Inherited from: Accessor

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

hasNextStep

readonly Property
Type
boolean

This property indicates whether there is a next step in the workflow.

hasPreviousStep

readonly Property
Type
boolean

This property indicates if there is a previous step in the workflow.

started

readonly Property
Type
boolean

Indicates whether the workflow is considered active.

Default value
false

stepId

readonly Property
Type
S

The name of the current step in the workflow.

type

readonly Property
Type
"add-association" | "create-features" | "merge-features" | "split-feature" | "update" | "update-feature" | "update-features" | "update-table-record"

Value indicating the workflow type.

Possible ValueDescription
create-featuresThis allows the end user to create either individual or continuous features in the feature service. (Since 4.23)
updateThis allows the end user to update and/or delete features in the feature service.

These workflows are only enabled if the feature service allows these operations.

Methods

MethodSignatureClass
cancel(options?: CancelWorkflowOptions): Promise<void>
commit(): Promise<void>
emit
inherited
emit<Type extends EventNames<this>>(type: Type, event?: this["@eventTypes"][Type]): boolean
hasEventListener
inherited
hasEventListener<Type extends EventNames<this>>(type: Type): boolean
next(): Promise<void>
on
inherited
on<Type extends EventNames<this>>(type: Type, listener: EventedCallback<this["@eventTypes"][Type]>): ResourceHandle
previous(options?: WorkflowPreviousOptions): Promise<void>
reset(): Promise<void>
start(): Promise<any>

cancel

Method
Signature
cancel (options?: CancelWorkflowOptions): Promise<void>

Cancels the active workflow.

Parameters
ParameterTypeDescriptionRequired
options

An object with the following properties.

Returns
Promise<void>

Resolves when the active workflow is canceled.

commit

Method
Signature
commit (): Promise<void>
Since
ArcGIS Maps SDK for JavaScript 4.15

Call this method when the workflow is considered finished. This is used to help process the editing results.

Returns
Promise<void>

Resolves when the active workflow commits and processes the edited results.

emit

inherited Method
Signature
emit <Type extends EventNames<this>>(type: Type, event?: this["@eventTypes"][Type]): boolean
Type parameters
<Type extends EventNames<this>>
Inherited from: EventedMixin

Emits an event on the instance. This method should only be used when creating subclasses of this class.

Parameters
ParameterTypeDescriptionRequired
type
Type

The name of the event.

event
this["@eventTypes"][Type]

The event payload.

Returns
boolean

true if a listener was notified

hasEventListener

inherited Method
Signature
hasEventListener <Type extends EventNames<this>>(type: Type): boolean
Type parameters
<Type extends EventNames<this>>
Inherited from: EventedMixin

Indicates whether there is an event listener on the instance that matches the provided event name.

Parameters
ParameterTypeDescriptionRequired
type
Type

The name of the event.

Returns
boolean

Returns true if the class supports the input event.

next

Method
Signature
next (): Promise<void>

Moves to the next step in the workflow.

Returns
Promise<void>

Resolves when moved to the next step within the active workflow.

on

inherited Method
Signature
on <Type extends EventNames<this>>(type: Type, listener: EventedCallback<this["@eventTypes"][Type]>): ResourceHandle
Type parameters
<Type extends EventNames<this>>
Inherited from: EventedMixin

Registers an event handler on the instance. Call this method to hook an event with a listener.

Parameters
ParameterTypeDescriptionRequired
type
Type

An event or an array of events to listen for.

listener
EventedCallback<this["@eventTypes"][Type]>

The function to call when the event fires.

Returns
ResourceHandle

Returns an event handler with a remove() method that should be called to stop listening for the event(s).

PropertyTypeDescription
removeFunctionWhen called, removes the listener from the event.
Example
view.on("click", function(event){
// event is the event handle returned after the event fires.
console.log(event.mapPoint);
});

previous

Method
Signature
previous (options?: WorkflowPreviousOptions): Promise<void>

Moves to the previous step in the workflow.

Parameters
ParameterTypeDescriptionRequired
options

Options when calling this method.

Returns
Promise<void>

Resolves when moved to the previous step within the active workflow.

reset

Method
Signature
reset (): Promise<void>

Resets the workflow.

Returns
Promise<void>

Resolves when the active workflow is reset.

start

Method
Signature
start (): Promise<any>

Starts the workflow.

Returns
Promise<any>

Resolves when the active workflow starts.

Type definitions

WorkflowPreviousOptions

Type definition

cancelCurrentStep

Property
Type
boolean

Cancels the current workflow when calling this method. Default value is false.