Controlling the AgentApp Widget in Runtime

The methods described in this section are used to perform actions inside the AgentApp widget, or to obtain information from the widget.

Method

Return Value

Description/Notes

Example

startInteraction(objectId:string, objectName:string

None

Starts an Interaction with a given objectId and name.

agentapp.startInteraction("51ad9318f7a431cd1f0c6ee6",
"myInteraction");

next(instanceId:string)

None

Clicks the Next button on the tab belonging to a given instanceId. After Next is clicked, the callback function is called.

function performNext() {
      agentApp.next(instanceid);

back(instanceId:string)

None

Clicks the Back button on the tab belonging to a given instanceId. After Back is clicked, the callback function is called.

function performBack() {
      agentApp.back(instanceid);

registerEvent(eventName:string, callback([event params]));

None

Registers an event with the callback that is invoked when the event is triggered. For a list of available events, refer to Listening for AgentApp Events.

agentApp.registerEvent('started', function(e) {
intid.value=e.objectInstanceId;
instanceid = e.objectInstanceId;
});

getCurrentInstanceId()

string

Returns the instanceId of the currently selected tab.

function getCurrentInstanceId() {
       str = agentApp.getCurrentInstanceId();

getActiveInteractionIds()

string [ ]

Returns an array of the InstanceIds of all the currently active Interactions (in all tabs of the widget).

function getActiveInteractionIds() {
      var ids = agentApp.getActiveInteractionIds();

loadHistory(uniqueId:string, [tipText:string], [closeDelay:integer milliseconds],[loadHistory:boolean])

None

Opens a new History Flow tab. The string is a unique ID number of an Interaction instance. The following optional parameters are available:

tipText: This text is displayed in a tooltip over the new tab.

closeDelay: Closes the tooltip after the specified number of milliseconds passes.

loadHistory: This flag defines whether or not to switch to the History Flow tab after it is opened.

agentapp.loadHistory(0812002, "myTooltipDescription", 50);