Name
global.InteractionTypeUtil
Description
No description available
Script
var InteractionTypeUtil = Class.create();
InteractionTypeUtil.prototype = {
initialize: function() {},
getConversationInteractionTypes: function() {
return ["chat", "messaging"];
},
/**
* Used for deciding whether messges can be sent for an interaction. Always true for
* conversational interaction types "chat" and "messaging". For other types, true only
* if there is an associated conversation record that has a consumer_account with a
* provider_application set (customer-adapter-enabled).
*/
canSendMessages: function(current) {
if (new ArrayUtil().contains(this.getConversationInteractionTypes(), current.type))
return true;
if ('sys_cs_conversation' != current.channel_metadata_table || gs.nil(current.channel_metadata_document))
return false;
var conversationGR = new GlideRecord('sys_cs_conversation');
conversationGR.addQuery('sys_id', current.channel_metadata_document);
conversationGR.addNotNullQuery('consumer_account.provider_application');
conversationGR.setLimit(1);
conversationGR.setWorkflow(false);
conversationGR.queryNoDomain();
return conversationGR.hasNext();
},
type: 'InteractionTypeUtil'
};
Sys ID
c3437fec87e3001009f77d3d87cb0b01