-
Notifications
You must be signed in to change notification settings - Fork 120
ProConcepts Workflow Manager Classic
The ArcGIS.Desktop.Workflow namespace provides access to classes and members that allow you to:
- Establish and manage a Workflow Manager database connection
- Create jobs and configure their properties
- Execute job workflows and queries
- Retrieve configuration information from the Workflow Manager database
ArcGIS.Desktop.Workflow.dll
Language: C#
Subject: Workflow Manager
Contributor: ArcGIS Pro SDK Team <arcgisprosdk@esri.com>
Organization: Esri, http://www.esri.com
Date: 10/06/2024
ArcGIS Pro: 3.4
Visual Studio: 2022
A workflow connection provides access to the jobs and configuration elements within a Workflow Manager enterprise geodatabase.
A prerequisite to using the Workflow Manager ArcGIS Pro SDK is that the workflow connection must be set up in the project in advance. For more information on how to configure a workflow connection, see Workflow connection.
An ArcGIS Pro project only supports one workflow connection at a time, so the active workflow connection can be accessed directly using the ConnectAsync
method from the WorkflowModule class.
// Get JobsManager and ConfigurationManager for the project
var connection = await QueuedTask.Run(() => WorkflowModule.ConnectAsync());
var jobsManager = connection.GetManager<ArcGIS.Desktop.Workflow.Models.JobsManager>();
var configManager = connection.GetManager<ArcGIS.Desktop.Workflow.Models.ConfigurationManager>();
The Jobs Manager
class provides access to the jobs within Workflow Manager. A Job
is an object representing a single unit of work that is carried out within an organization. A job is created using the CreateNewJob
method, which uses a template known as a job type to configure a job with the desired properties and components (such as the Workflow and Maps).
// Create a job
await QueuedTask.Run(async () =>
{
// Connect to the workflow connection. The workflow connection provides connection status information and
// allows interaction with the Workflow Manager system through managers.
WorkflowConnection connection = await WorkflowModule.ConnectAsync();
// Access configuration and job information
var configMgr = connection.GetManager<ArcGIS.Desktop.Workflow.Models.ConfigurationManager>();
var jobType = configMgr.GetVisibleJobTypes().FirstOrDefault();
JobsManager jobsMgr = connection.GetManager<JobsManager>();
var jobID = jobsMgr.CreateNewJob(jobType.ID);
var job = jobsMgr.GetJob(jobID);
});
The primary identifier of a job is its unique ID, and it is the primary input parameter for methods within the Jobs Manager
class such as GetJob
and CloseJobs
.
If the desired job's ID is unknown, you can use job queries to find it in the Workflow Manager database.
Queries are SQL statements that filter the Workflow Manager jobs based on predefined criteria such as who the job is assigned to or the priority of the job. Queries can be executed by using their name or their ID from the Jobs Manager
class within the methods ExecuteQuery
and ExecuteQueryXML
.
// Execute "All Jobs" Query
await QueuedTask.Run(async () =>
{
// Connect to the workflow connection. The workflow connection provides connection status information and
// allows interaction with the Workflow Manager system through managers.
WorkflowConnection connection = await WorkflowModule.ConnectAsync();
// Access configuration and job information
JobsManager jobsMgr = connection.GetManager<JobsManager>();
var queryResultReturn = jobsMgr.ExecuteQuery("All Jobs");
});
The Configuration Manager
class provides access to many configuration elements that are defined within the Workflow Manager database such as users, groups, and data workspaces. All of these elements are read-only from the database.
To obtain details on a specific user, you can use the GetUser
method. To obtain a list of job types that the current user can access for job creation, use GetVisibleJobTypes
.
// Get the job types that are visible to the current user
await QueuedTask.Run(async () =>
{
// Connect to the workflow connection. The workflow connection provides connection status information and
// allows interaction with the Workflow Manager system through managers.
WorkflowConnection connection = await WorkflowModule.ConnectAsync();
// Access configuration and job information
var configMgr = connection.GetManager<ArcGIS.Desktop.Workflow.Models.ConfigurationManager>();
var jobsTypes = configMgr.GetVisibleJobTypes();
});
Other methods contained in this class include GetAllUsers
, GetAllGroups
, GetJobPriorities
, GetDataWorkspaces
, and GetConfigurationProperty
.
The Job
class provides access to a Workflow Manager job. A Job
may have one or many people working on it. It can be associated with a single dataset, multiple datasets, or no data at all. It is created from a job type, and many of its properties (e.g., assignment) and components (e.g., attachments) can be obtained and set in the Job
class. Once a value has been changed for a job, it must be saved using the Save
method for the change to be committed to the Workflow Manager database.
For more information on what a job is, see Workflow jobs..
// Get a job and change its description
await QueuedTask.Run(async () =>
{
// Connect to the workflow connection. The workflow connection provides connection status information and
// allows interaction with the Workflow Manager system through managers.
WorkflowConnection connection = await WorkflowModule.ConnectAsync();
JobsManager jobsMgr = connection.GetManager<JobsManager>();
var job = jobsMgr.GetJob("512");
job.Description = "This is a test";
job.Save();
});
Once a job has been created or obtained and is assigned to the current user it can be executed.
Workflow execution consists of executing and completing steps in the job. Before executing a step it is important to check whether the step can be executed using the CanExecuteStep
method. A step can be executed if the job is assigned to the current user, the job does not have an active hold and the job is not closed. Similarly to complete a step check to see if it can be completed using the CanCompleteStep
method.
Use the ExecuteStep
and CompleteStep
methods to run the workflow. To move to a different step in the workflow use the SetCurrentStep
method.
// Execute a step in the workflow
await QueuedTask.Run(async () =>
{
// Connect to the workflow connection. The workflow connection provides connection status information and
// allows interaction with the Workflow Manager system through managers.
WorkflowConnection connection = await WorkflowModule.ConnectAsync();
JobsManager jobsMgr = connection.GetManager<JobsManager>();
var job = jobsMgr.GetJob(jobID);
string stepID = job.GetCurrentSteps().First();
Tuple<bool, string> canExecute = job.CanExecuteStep(stepID);
if (canExecute.Item1 == true)
job.ExecuteStep(stepID);
else
{
string errorMsg = canExecute.Item2;
// do something with the error message
}
});
Home | API Reference | Requirements | Download | Samples
- Overview of the ArcGIS Pro SDK
- What's New for Developers at 3.4
- Installing ArcGIS Pro SDK for .NET
- Release notes
- Resources
- Pro SDK Videos
- ProSnippets
- ArcGIS Pro API
- ProGuide: ArcGIS Pro Extensions NuGet
Migration
- ProSnippets: Framework
- ProSnippets: DAML
- ProConcepts: Framework
- ProConcepts: Asynchronous Programming in ArcGIS Pro
- ProConcepts: Advanced topics
- ProGuide: Custom settings
- ProGuide: Command line switches for ArcGISPro.exe
- ProGuide: Reusing ArcGIS Pro Commands
- ProGuide: Licensing
- ProGuide: Digital signatures
- ProGuide: Command Search
- ProGuide: Keyboard shortcuts
Add-ins
- ProGuide: Installation and Upgrade
- ProGuide: Your first add-in
- ProGuide: ArcGIS AllSource Project Template
- ProConcepts: Localization
- ProGuide: Content and Image Resources
- ProGuide: Embedding Toolboxes
- ProGuide: Diagnosing ArcGIS Pro Add-ins
- ProGuide: Regression Testing
Configurations
Customization
- ProGuide: The Ribbon, Tabs and Groups
- ProGuide: Buttons
- ProGuide: Label Controls
- ProGuide: Checkboxes
- ProGuide: Edit Boxes
- ProGuide: Combo Boxes
- ProGuide: Context Menus
- ProGuide: Palettes and Split Buttons
- ProGuide: Galleries
- ProGuide: Dockpanes
- ProGuide: Code Your Own States and Conditions
Styling
- ProSnippets: Content
- ProSnippets: Browse Dialog Filters
- ProConcepts: Project Content and Items
- ProConcepts: Custom Items
- ProGuide: Custom Items
- ProGuide: Custom browse dialog filters
- ArcGIS Pro TypeID Reference
- ProSnippets: Editing
- ProConcepts: Editing
- ProConcepts: COGO
- ProConcepts: Annotation Editing
- ProConcepts: Dimension Editing
- ProGuide: Editing Tool
- ProGuide: Sketch Tool With Halo
- ProGuide: Construction Tools with Options
- ProGuide: Annotation Construction Tools
- ProGuide: Annotation Editing Tools
- ProGuide: Knowledge Graph Construction Tools
- ProGuide: Templates
3D Analyst Data
Plugin Datasources
Topology
Linear Referencing
Object Model Diagram
- ProSnippets: Geometry
- ProSnippets: Geometry Engine
- ProConcepts: Geometry
- ProConcepts: Multipatches
- ProGuide: Building Multipatches
Relational Operations
- ProSnippets: Knowledge Graph
- ProConcepts: Knowledge Graph
- ProGuide: Knowledge Graph Construction Tools
Reports
- ProSnippets: Map Authoring
- ProSnippets: Annotation
- ProSnippets: Charts
- ProSnippets: Labeling
- ProSnippets: Renderers
- ProSnippets: Symbology
- ProSnippets: Text Symbols
- ProConcepts: Map Authoring
- ProConcepts: Annotation
- ProConcepts: Dimensions
- ProGuide: Tray buttons
- ProGuide: Custom Dictionary Style
- ProGuide: Geocoding
3D Analyst
CIM
Graphics
Scene
Stream
Voxel
- ProSnippets: Map Exploration
- ProSnippets: Custom Pane with Contents
- ProConcepts: Map Exploration
- ProGuide: Map Pane Impersonation
- ProGuide: TableControl
Map Tools
- ProGuide: Feature Selection
- ProGuide: Identify
- ProGuide: MapView Interaction
- ProGuide: Embeddable Controls
- ProGuide: Custom Pop-ups
- ProGuide: Dynamic Pop-up Menu
Network Diagrams
- ArcGIS Pro API Reference Guide
- ArcGIS Pro SDK (pro.arcgis.com)
- arcgis-pro-sdk-community-samples
- ArcGISPro Registry Keys
- ArcGIS Pro DAML ID Reference
- ArcGIS Pro Icon Reference
- ArcGIS Pro TypeID Reference
- ProConcepts: Distributing Add-Ins Online
- ProConcepts: Migrating to ArcGIS Pro
- FAQ
- Archived ArcGIS Pro API Reference Guides
- Dev Summit Tech Sessions