Rollback Activity Instances

API Type

Web Services

Description

Rolls back a process instance according to a specified instruction. The class WFPartialRollbackInstructionis used to specify detailed information about the instruction.

Syntax

public virtual WFEvent RollbackActivityInsts(WFPartialRollbackInstruction instruction)

Parameters

Name Description

instruction

Definition:
Specifies the instructions for the partial rollback.
Type
WFPartialRollbackInstruction
Allowed Values:
A WFPartialRollbackInstruction object.

Output

WFEvent object that provides the status of the transaction. The possible statuses are:

  • Sent - Indicates event has been sent to engine for processing.
  • Failed - Indicates event failed to process.
  • Processed - Indicates event has been processed successfully.
  • Canceled - Indicates event was canceled.
  • Deferred - Indicates event does not need to be sent immediately.

Example

//Sample for partial rollback
IWFWorkflowService svc = GetWorkflowService();

// PartialRollback unit
WFPartialRollbackInstruction.PartialRollbackUnit unit1 = 
       new WFPartialRollbackInstruction.PartialRollbackUnit();
unit1.DestinationActivityInstanceID = 
       ... // destination activity instance ID
unit1.SourceActivityInstanceIDs = 
       new string[] { ... }; // array of source activity instance ID
WFPartialRollbackInstruction.PartialRollbackUnit unit2 = 
       new WFPartialRollbackInstruction.PartialRollbackUnit();
unit2.DestinationActivityInstanceID = 
        ... // destination activity instance ID
unit2.SourceActivityInstanceIDs = 
       new string[] { … }; // array of source activity instance ID
WFPartialRollbackInstruction instruction = 
       new WFPartialRollbackInstruction();
instruction.PartialRollbackUnits = 
       new WFPartialRollbackInstruction.PartialRollbackUnit[] 
       {unit1,unit2};

try
	{
    //Rolling back the activity instance
    WFEvent evt = workflowService. RollbackActivityInsts(instruction);
	}

catch (Exception ex)
	{
    Console.WriteLine("Failed! " + ShUtil.GetSoapMessage(ex));
	}

Supported Versions

4.6 and higher