Name

sn_oe_sfs.SidebarToastNotificationUtils

Description

No description available

Script

var SidebarToastNotificationUtils = Class.create();
SidebarToastNotificationUtils.prototype = {
  NEXT_EXPERIENCE_ROUTE_SYS_ID: "bccd1214533201107cd3ddeeff7b1289",
  OPEN_COLLAB_CHAT_IN_DOOCK: "SN_COLLAB_CHAT_LIST#OPEN_COLLAB_CHAT_IN_DOCK",

  initialize: function() {
  },

  sendNewNotification: function(recipientId, chatId, messageId, senderName) {
  	var notificationGR = new GlideRecord("ui_notification_inbox");			
  	notificationGR.setValue("recipient", recipientId);
  	notificationGR.setValue("route", this.NEXT_EXPERIENCE_ROUTE_SYS_ID);
  	notificationGR.setValue("status", "new");
  	notificationGR.setValue("target", messageId);
  	notificationGR.setValue("target_table", "sys_cs_collab_message");
  	notificationGR.setValue("triggered_by", "system");
  	// Set the payload with the correct templated messages
  	// to be displayed in the notification
  	var payload = {
  		"action_name" : this.OPEN_COLLAB_CHAT_IN_DOOCK,
  		"action_payload": {
  			"id": "" + chatId,
  			"messageSysId": "" + messageId
  		},
  		"message_icon" : "ongoing_outline",
  		"message_type" : "nextExperienceNotification",
  		"message_heading" : gs.getMessage("New mention in Sidebar"),
  		"message" : gs.getMessage("{0} mentioned you", senderName)
  	};
  	notificationGR.setValue("payload", JSON.stringify(payload));
  	notificationGR.insert();
  },

  type: 'SidebarToastNotificationUtils'
};

Sys ID

aeda1202c74211100c2c770bf4c26098

Offical Documentation

Official Docs: