ArcGIS Pro 2.9 API Reference Guide
ExecuteStep(String) Method
Example 

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
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;
}
Requirements

Target Platforms: Windows 11, Windows 10, Windows 8.1

See Also

Reference

Job Class
Job Members