{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":831,"path":"api-reference/server-api-reference/InteractionScopedAPI.md","title":"Interaction - Scoped","bundle":null,"doc_type":null,"release":"australia","body":"\n# Interaction- Scoped\n\nThe Interaction API provides methods that enable you to define the behavior for interaction records.\n\nThis class requires the Interaction Logging, Routing, and Queueing plugin \\(com.glide.interaction\\) and runs in the `sn_interaction` namespace.\n\n**Parent Topic:**[Server API reference](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/api-server.md)\n\n## Interaction - accept\\(\\)\n\nAccepts a new interaction.\n\nAccepting a transfer only works for pending transfers. Find any pending transfers in the Interaction Agent Transfer \\[interaction\\_agent\\_transfer\\] table.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n|Type|Description|\n|----|-----------|\n|Boolean|Returns true if the transfer is accepted.|\n\n```\nvar now_GR = new GlideRecord('interaction');\nGR.get('b2c0a3af202a1300964f959e0488de75');\nvar interaction = sn_interaction.Interaction.getInteraction(GR).accept();\n```\n\n## Interaction - create\\(Object options\\)\n\nCreates an interaction.\n\n<table id=\"table_ubv_mql_d2b\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\noptions\n\n</td><td>\n\nObject\n\n</td><td>\n\nField 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.`\n\n</td></tr></tbody>\n</table>|Type|Description|\n|----|-----------|\n|Object|Interaction|\n\n```\nvar interactionObj = sn_interaction.Interaction.create({\n\tchannel: '28a59893873103002ae97e2526cb0b5d',\n\tchannel_metadata:{},\n\topened_for: '46d44a23a9fe19810012d100cca80666',\n\tqueue: 'f3a50867b30303002186a72256a8dcb7'\n});\n```\n\n## Interaction - getInteraction\\(GlideRecord interaction\\)\n\nReturns an interaction record.\n\n|Name|Type|Description|\n|----|----|-----------|\n|interaction|GlideRecord|Interaction record from the interaction table \\[interaction\\] that is retrieved from the system.|\n\n|Type|Description|\n|----|-----------|\n|Object|Interaction|\n\n```\nvar now_GR = new GlideRecord('interaction');\nnow_GR.get('608a21bd096a9300964ffbd57ba7dd8d');\nvar interaction = sn_interaction.Interaction.getInteraction(now_GR);\n```\n\n## Interaction - transferToAgent\\(String sysID\\)\n\nTransfers an interaction record to an agent using the sys\\_id for the agent.\n\nWhen 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.\n\n**Note:** This method has been deprecated.\n\n|Name|Type|Description|\n|----|----|-----------|\n|SysID|String|The sys\\_id of the user you want to transfer an interaction record to.|\n\n|Type|Description|\n|----|-----------|\n|void| |\n\n```\nvar now_GR = new GlideRecord('interaction');\nGR.get('24b927ef202a1300964f959e0488de2d');\nvar interaction = sn_interaction.Interaction.getInteraction(GR);\ninteraction.transferToAgent('6816f79cc0a8016401c5a33be04be441');\n```\n\n## Interaction - transferToQueue\\(String sysID\\)\n\nTransfers an interaction record to an interaction queue.\n\nTransferring an interaction from one queue to another closes the original interaction and creates an interaction in the new queue.\n\n**Note:** This method has been deprecated.\n\n|Name|Type|Description|\n|----|----|-----------|\n|SysID|String|The sys\\_id of the interaction queue you want to transfer the interaction record to.|\n\n|Type|Description|\n|----|-----------|\n|void| |\n\n```\nvar now_GR = new GlideRecord('interaction');\nGR.get('24b927ef202a1300964f959e0488de2d');\nvar interaction = sn_interaction.Interaction.getInteraction(GR);\ninteraction.transferToQueue('86fee1933b101300088d832b44efc474');\n```\n\n"}}