Platform SDK: Exchange 2000 Server

ActionTable Property

[This is preliminary documentation and subject to change.]

Contains the state-transition rules for a workflow process definition, stored as an ADO Recordset. This is the central part of a workflow application.

[Visual Basic,VBScript]
Public Property ActionTable as ADODB.Recordset
[C++]
HRESULT get_ActionTable(_Recordset** ppVal);
HRESULT put_ActionTable(_Recordset* pVal);
[IDL]
HRESULT [propget] ActionTable([out,retval] _Redordset** ppVal);
HRESULT [propput] ActionTable([in] _Redordset* pVal);

Remarks

When you save the ProcessDefinition, it validates the ActionTable to prevent the use of a poorly formed table.

The Action Table recordset requires the following thirteen schema:

  1. "ID", String, A unique ID for this row
  2. "Caption", String, A display name for this step (optional)
  3. "State", String, The current state of the ProcessInstance.
  4. "NewState", String, The new state of the ProcessInstance, upon successful completion of this step.
  5. "EventType", String, The type of event this step represents. CDOWFEventType enum lists possible values.
  6. "Condition", String, A script, common script call, or COM object ProgID whose result should be boolean. If you write the ProcessDefinition without the help of the ProcessDefinition object, the workflow engine will evaluate empty conditions as false. If you use the ProcessDefinition object, it will validate the action table and require a condition. An empty condition causes an error. If the workflow engine does not find a row in the ActionTable with a matching CdoWfEventType and a 'TRUE' condition, it returns a failure code CDOWF_NO_CONDS_MATCHED.
  7. "EvaluationOrder",....String, The position of a row in the order which action table rows will be evaluated given multiple matching rows in a call to advance. If this column of the action table contains no values, then no order is guaranteed. Actiontables may have a mixture of blank and numeric entries, but only if they are not mixed for a given current state and event type.
  8. "Action", String, A script, common script call, or COM object ProgID that executes if action table row matches the process instance and condition is true.
  9. "ExpiryInterval", String, The duration (in minutes) that the item should remain in the new state before triggering an OnExpiry event. Only used with the OnEnter event type.
  10. "RowACL", String, Required field reserved for future use. Must be empty.
  11. "TransitionACL", String, You can define an ACL for the transition here that will override the default ACL which is the folder ACL.
  12. "DesignToolFields", String,
  13. "CompensatingAction", String, A script, common script call, or COM object ProgID to run if the workflow transaction gets aborted.
  14. "Flags", String, Bitwise OR of cdowfTransitionFlags that indicate which columns in the action table will contain COM objects and which will contain script. Use zero (0x00) if this row contains only script conditions and actions.

The workflow engine performs a number of consistency checks as it processes a transition. The following list summarizes the checks and the error type returned by the workflow engine.

Consistency Check Error Message
The actiontable is empty: CDOWF_EMPTY_ACTIONTABLE.
A column is missing, the data type isn't a string, or the workflow engine has any other trouble reading a row: CDOWF_E_BAD_ACTIONTABLE
The event type is empty: CDOWF_E_EMPTY_EVENTTYPE
The event type is not valid: CDOWF_E_INVALID_EVENTTYPE
The State column has something in it and shouldn't have (for OnCreate and OnEnter): CDOWF_E_NONEMPTY_CURSTATE
The State column is empty and shouldn't be: CDOWF_E_EMPTY_CURSTATE
The NewState column has something in it and shouldn't have: CDOWF_E_NONEMPTY_NEWSTATE
The NewState column is empty and shouldn't be: CDOWF_E_EMPTY_NEWSTATE
A transition acl is used in an onexpiry event (OnExpiry doesn't really have a "current user", so transition acls don't make sense in this case): CDOWF_E_TRANSITIONACL_NO_USE_ONEXPIRY
TransitionFlags is empty or not valid: CDOWF_E_ROW_INVALID_FLAGS
EvaluationOrder has a duplicate order entry, the entry is not a number, or the sequence is not logical. CDOWF_E_DUPLICATE_ORDER

CDOWF_E_ROW_DUPLICATE_ORDER

CDOWF_E_ROW_INVALID_SEQUENCENUMBER

CDOWF_E_ROW_INVALID_SEQUENCING

CDOWF_INVALID_EVALUATION_ORDER


Example

The following code uses Microsoft® ActiveX® Data Objects 2.5 to create a new recordset with the appropriate fields for an action table.

[Visual Basic]
   Dim Rs As ADODB.Recordset
   Set Rs = New ADODB.Recordset

   With Rs.Fields
    .Append "ID", adBSTR
    .Append "Caption", adBSTR
    .Append "State", adBSTR
    .Append "NewState", adBSTR
    .Append "EventType", adBSTR
    .Append "Condition", adBSTR
    .Append "EvaluationOrder", adBSTR
    .Append "Action", adBSTR
    .Append "ExpiryInterval", adBSTR
    .Append "RowACL", adBSTR
    .Append "TransitionACL", adBSTR
    .Append "DesignToolFields", adBSTR
    .Append "CompensatingAction", adBSTR
    .Append "Flags", adBSTR
   End With

   Dim varColumnNames As Variant

   varColumnNames = Array(Rs.Fields.Item(0).Name, _
                         Rs.Fields.Item(1).Name, _
                         Rs.Fields.Item(2).Name, _
                         Rs.Fields.Item(3).Name, _
                         Rs.Fields.Item(4).Name, _
                         Rs.Fields.Item(5).Name, _
                         Rs.Fields.Item(6).Name, _
                         Rs.Fields.Item(7).Name, _
                         Rs.Fields.Item(8).Name, _
                         Rs.Fields.Item(9).Name, _
                         Rs.Fields.Item(10).Name, _
                         Rs.Fields.Item(11).Name, _
                         Rs.Fields.Item(12).Name, _
                         Rs.Fields.Item(13).Name)

The following code creates a new Recordset object, creates the fields in the recordset, opens the Recordset, adds new records to the recordset representing the rows in the action table, saves the recordset, and closes it.

[Visual Basic]
   Rs.Open
   If Err.Number <> 0 Then
      Debug.Print "Failed to open ActionTable Recordset" & Err.Description
   End If

   With Rs
    .AddNew varColumnNames, Array("1", "OnCreate", "", "Submitted", "OnCreate", "true", "", "sendmail(""new ProcessInstance"")", "", "", "", "", "", "0")
    .AddNew varColumnNames, Array("2", "OnEnter", "", "Submitted", "OnEnter", "true", "", "sendmail(""entered submitted state"")", "", "", "", "", "", "0")
    .AddNew varColumnNames, Array("3", "OnExpiry", "Submitted", "Submitted", "OnExpiry", "true", "", "sendmail(""submitted state expired"")", "", "", "", "", "", "0")
    .AddNew varColumnNames, Array("4", "OnDelete", "Submitted", "", "OnDelete", "true", "", "sendmail(""deleted ProcessInstance"")", "", "", "", "", "", "0")
   End With

See Also

IProcessDefinition Interface