The Interaction API provides methods that enable you to define the behavior for interaction records.

This class requires the Interaction Logging, Routing, and Queueing plugin (com.glide.interaction) and runs in the sn_interaction namespace.

Interaction - accept()

Accepts a new interaction.

Accepting a transfer only works for pending transfers. Find any pending transfers in the Interaction Agent Transfer [interaction_agent_transfer] table.

Table 1. Parameters
Name Type Description
None
Table 2. Returns
Type Description
Boolean Returns true if the transfer is accepted.

Example

var now_GR = new GlideRecord('interaction');
GR.get('b2c0a3af202a1300964f959e0488de75');
var interaction = sn_interaction.Interaction.getInteraction(GR).accept();

Interaction - create(Object options)

Creates an interaction.

Table 3. Parameters
Name Type Description
options Object Field values for an interaction record. The channel field with the channel sys_id and channel metadata are required.

If a queue is not included in the parameter, the system returns Interaction b2c0a3af202a1300964f959e0488de75 has no queue specified... running queue matching rules.

Table 4. Returns
Type Description
Object Interaction

Example

var interactionObj = sn_interaction.Interaction.create({
	channel: '28a59893873103002ae97e2526cb0b5d',
	channel_metadata:{},
	opened_for: '46d44a23a9fe19810012d100cca80666',
	queue: 'f3a50867b30303002186a72256a8dcb7'
});

Interaction - getInteraction(GlideRecord interaction)

Returns an interaction record.

Table 5. Parameters
Name Type Description
interaction GlideRecord Interaction record from the interaction table [interaction] that is retrieved from the system.
Table 6. Returns
Type Description
Object Interaction

Example

var now_GR = new GlideRecord('interaction');
now_GR.get('608a21bd096a9300964ffbd57ba7dd8d');
var interaction = sn_interaction.Interaction.getInteraction(now_GR);

Interaction - transferToAgent(String sysID)

Transfers an interaction record to an agent using the sys_id for the agent.

When an interaction is transferred from one agent to another, the interaction needs to be accepted or rejected using GlideRecord APIs. Use the GlideRecord API to change the state of the interaction and update. For more information, see the GlideRecord - update method.

Note: This method has been deprecated.
Table 7. Parameters
Name Type Description
SysID String The sys_id of the user you want to transfer an interaction record to.
Table 8. Returns
Type Description
void

Example

var now_GR = new GlideRecord('interaction');
GR.get('24b927ef202a1300964f959e0488de2d');
var interaction = sn_interaction.Interaction.getInteraction(GR);
interaction.transferToAgent('6816f79cc0a8016401c5a33be04be441');

Interaction - transferToQueue(String sysID)

Transfers an interaction record to an interaction queue.

Transferring an interaction from one queue to another closes the original interaction and creates an interaction in the new queue.

Note: This method has been deprecated.
Table 9. Parameters
Name Type Description
SysID String The sys_id of the interaction queue you want to transfer the interaction record to.
Table 10. Returns
Type Description
void

Example

var now_GR = new GlideRecord('interaction');
GR.get('24b927ef202a1300964f959e0488de2d');
var interaction = sn_interaction.Interaction.getInteraction(GR);
interaction.transferToQueue('86fee1933b101300088d832b44efc474');