ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Desktop.Workflow.Models.JobModels Namespace / Job Class / ExecuteStep(String) Method
The ID of the step to execute. If no step is specified, the current step will be executed
Example Version

ExecuteStep(String) Method
Executes the specified step
Syntax
public WorkflowExecutionResult ExecuteStep( 
   string stepID
)

Parameters

stepID
The ID of the step to execute. If no step is specified, the current step will be executed

Return Value

Information on the return code and errors during execution
Remarks
User should ensure the result of CanExecuteStepAsync is true prior to executing the step.
Example
Execute the current step and check for an exception
WorkflowExecutionResult result = job.ExecuteStep();
// Check if the step threw an exception
if (result.Exception != null)
{
    // Throw it for a higher level to deal with
    throw result.Exception;
}
if (result.HasReturnCode)
{
    return result.ReturnCode;
}
How to Execute a step on a job
// Gets the current step
// checks to see if it can execute it
// proceeds to do so if it can
var wfCon = await WorkflowModule.ConnectAsync();
var jobManager = wfCon.GetManager<JobsManager>();
var job = jobManager.GetJob(jobID);
string stepID = job.GetCurrentSteps().First();
if (job.CanExecuteStep(stepID).Item1)
  job.ExecuteStep(stepID);
Requirements

Target Platforms: Windows 11, Windows 10

ArcGIS Pro version: 3 or higher.
See Also