ArcGIS Pro 3.3 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

In This Topic
    ExecuteStep(String) Method
    In This Topic
    Executes the specified step
    Syntax
    public WorkflowExecutionResult ExecuteStep( 
       string stepID
    )
    Public Function ExecuteStep( _
       Optional ByVal stepID As String _
    ) As WorkflowExecutionResult

    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