How to replace connect chat code to Sidebar code
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2023 10:38 PM
Hi All, In one business rule there is a code, it will run when Assigned to changes and it will call the connect chat, but now in next UI experience it is deprecated. Below is the code, How to replace this code into Sidebar code.
Code:
(function executeRule(current, previous /*null when async*/ ) {
//-------- send connect notification when request is assigned to a user or re-assignment is done --------//
var ritm = current.getDisplayValue('number');
var newassignedto = current.getDisplayValue('assigned_to');
//Getting live group profile with request number in case of reassignment
var grLiveGrp = new GlideRecord('live_group_profile');
grLiveGrp.addQuery('name', ritm);
grLiveGrp.setLimit(1);
grLiveGrp.query();
if (grLiveGrp.next()) {
var conversation = sn_connect.Conversation.get(grLiveGrp.sys_id);
conversation.removeSubscriber(previous.assigned_to); // remove previous assigned to
conversation.addSubscriber(current.assigned_to); // add current assigned to
conversation.sendMessage(gs.getMessage('fnol.connect.hi') + newassignedto + gs.getMessage('fnol.connect.request.number') + ritm + gs.getMessage('fnol.connect.has.assign'));
} else {
// Create New live group profile with request number at first time request is assigned to
var conversationNew = sn_connect.Conversation.create({
name: ritm,
type: "connect"
});
conversationNew.addSubscriber(current.assigned_to); // add new assigned to
conversationNew.removeSubscriber(gs.getUserID()); // remove current logged in user
conversationNew.sendMessage(gs.getMessage('fnol.connect.hi') + newassignedto + gs.getMessage('fnol.connect.request.number') + ritm + gs.getMessage('fnol.connect.has.assign'));
}
})(current, previous);
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2023 02:17 AM
Hello @poonamdhole5,
Please refer to the below link:
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB1123615
If it is helpful, mark it as a thumbs-up and accept the correct solution.
Thanks & Regards,
Abbas