Interaction-Activity Framework Properties, Methods, and Events

The Interaction.xml file defines the context, activities, and associated plug-ins These definitions are used at design time to populate a set of methods you can use to update the context and to execute activities. OpenSpan Studio creates these methods for your convenience.

Keep in mind that neither the interaction-activity framework nor the event collection service enforces the accuracy of activity and context definitions. If an activity is raised that is not in the definition, it is ignored by participants who do not recognize it. All methods call into generic functions that take string keys for context fields or activities.

Likewise, the event collection service automatically maps context and activity event fields without pre-configuration. These definitions are also used by Agile Desktop plug-ins to render shortcuts, data, and so on.

Note: Design properties are accessed from the Properties Grid. Access all other properties, methods, and events directly from Object Explorer or by using the Configure Type option in Object Inspector.

Interaction Framework

The following tables describe the properties, methods, and events for the Interaction Framework.

Properties

The Interaction Manager dynamically generates the applicable properties as part of the interaction definition. This lets you get and set context values. For example, if the context is configured with these properties: FirstName, LastName, and FullName, the interaction component will contain these dynamically generated properties: FirstName, LastName, and FullName and those values will be available throughout the interaction.

Methods

Method

Description

Parameters

Return Type

ActivateInteraction

Makes the interaction you specify active.

interactionKey

string

CancelActivity

Use to cancel and activity. Enter the ID of activity work item you want to cancel in the workItemId parameter.

workItemId

integer

ClearContext

Removes all of the context values for the interaction you specify. The default is the current activity.

interactionKey

string

CloseInteraction

Closes the specified interaction and cancels all associated queued activities.

cancelRunningActivity

Boolean

GetActiveKey

Gets the interaction key of the active interaction. This method returns null if there is no active interaction.

none

object

GetInteractionKeys

Returns a list of the keys for all open interactions.

none

object

InteractionExists

Indicates if an interaction exists for the key you specify. This method returns True if the interaction exists, otherwise it returns False. Use the key parameter to specify the key of the interaction you want to search for.

key

Boolean

IsKeyActive

Indicates if the key you specify is active. This method returns True if the interaction is active, otherwise it returns False. Use the key parameter to specify the key you want to check.

key

Boolean

StartInteraction

Starts an interaction and makes it active. Identify the interaction you want to start with the interactionKey parameter. This key is a unique identifier, such as a Customer ID.

interactionKey

string

 

Events

Event

Description

InteractionActivated

This event fires when an interaction is activated.

InteractionClosed

This event fires when an interaction is closed.

InteractionStarted

This event fires when an interaction starts.

 

Activity Framework

The following tables describe the properties, methods, and events for the Activity Framework.

Properties

The Interaction Manager dynamically generates the applicable properties as part of the activity definition.

Methods

The Interaction Manager dynamically generates these methods. The parameters for these methods are based on the activity definition.

All of the start activity methods include the maxExecutionTime parameter which you can use to specify, in milliseconds, how long an activity can run after it has been removed from the queue. For instance, if you want an activity to process, but you want to limit its processing time to 30 seconds, you would enter 30000. With that setting, if the activity starts but does not finish within 30 seconds, it is removed from the queue. Using this parameter prevents a WaitForCreate method from blocking the activity queue. The default is blank, meaning there is no timeout interval.

Note: Be sure to always set the interactionKey parameter when you start an activity.

Method

Description

CancelActivity

This method provides a way to interrupt a WaitForCreate (WFC) method and return immediately.

For instance, in Interaction Framework, you can cancel an activity that is running. You can also cancel an activity that is in the queue. If, however, the activity was currently executing a WaitForCreate (WFC) method, the cancel would not take effect until the WaitForCreate finished processing. This means that if you were waiting for the WFC to time out, the act of cancelling would be blocked until the WFC finished. Use the CancelActivity method to avoid this situation.

Start

Queues the activity for the current interaction.

Note: This method replaces the StartActivity method used in prior versions. With the StartActivity method, when an activity was started, the item was added to the queue and the automation moved forward. If work was required once the activity was completed, you responded to a ActivityCompleted event. When you use this method, the automation waits until the activity finishes. Once the activity finishes, then the automation moves forward.

StartActivityForKey  

Adds an activity based on a key you specify. If your project makes use of multiple interactions, this is the safest method for starting an interaction.

StartNow

 Adds the activity to the top of the queue.

Note: This method replaces the StartActivityNow method used in prior versions. With the StartActivityNow method, when an activity was started, the item was added to the queue and the automation moved forward. If work was required once the activity was completed, you responded to a ActivityCompleted event. When you use this method, the automation waits until the activity finishes. Once the activity finishes, then the automation moves forward.

StartActivityNowForKey

Adds an activity based on a key you specify and places the activity at the top of the queue.

StartAndWait

Use this method in automations that start an activity by placing it at the bottom of the activity queue. The automation will then block the automation from proceeding until the activity has reached the top of the queue and executes completely.

 StartNowAndWait

Use this method in automations that start an activity by placing it at the top of the activity queue. The automation will not proceed until the activity executes completely.

 

Events

These events are sent by the InteractionHostService:

Event

Description

ActivityCanceled

Fires the ActivityCanceled event if the Activity event arguments match this activity.

ActivityCompleted

Fires the ActivityCompleted event if the Activity event arguments match this activity.

ActivityStarted

Fires the ActivityStarted event if the Activity event arguments match this activity.