Inject/ Post message to Agent Chat interface from UI Action

Think Code
Tera Contributor

SNow_Issue.png

 Fellow Devs/ SNOW gurus

Is there any way for me to send a message through UI Action to the Active Agent Chat window from the incident form save action as shown in the image attached?

 

The usecase is simple - Agent is creating an incident from interaction. Upon creation of the message, it auto populates the INC number for the user to check. Wondering if there is any OOTB or other means to achieve this?

 

Things to consider : I believe each chat has a conversationid, hoping the the object model provides for access to the chat through programmatic means?

 

Any thoughts / solution towards this is greatly appreciated. Thanks in advance!

 

 

1 REPLY 1

PabloL
Tera Contributor

I found a way by scouring the Quick Actions [quickactions_action] table. Here's the code from the OOB Create Incident Quick Action:

var message = 'Incident created: ' + incidentGr.number;

sn_connect.Conversation.get(record.channel_metadata_document, record.channel_metadata_table)
	.sendMessage({
		body: message,
		system: false
	});

Looks like record is the Interaction GlideRecord object.

This worked for me when I tried it in a Background Script from the Global scope.