Is it possible to trigger browser notifications other than by sending a Connect chat message ?

Ximizu
Mega Guru

My customer would like to have a visual or sonor notification when a new record is inserted in a custom table.

The reason behind is that the agent working on this custom table need to be alerted in real-time when a new record is inserted, in order to take the necessary actions as fast as possible (e.g. Root cause analysis, solution finding, issue resolution). The user would not always be in front of the ServiceNow instance. That is why he needs to be alerted with a visual or sonor notification when he is focused on something else (e.g. need to be notified if he is currently in an excel spreadsheet).

I know that when we use the Connect feature, there is a visual and sonor notification: the receiver of the connect chat message would received a browser notification (see attached file browser_notification.JPG) and also a sonor notification if the servicenow is opened a browser, but the focus is somewhere else. 

find_real_file.png

So I was wondering if it was possible to trigger this kind of visual/sonor notifications (browser notification) other than than sending a connect chat message. Exemple: the trigger would be the insert of a new record. 

 

Related threads on the community

Running ServiceNow without Email integration

Chat notifications in browser

Looking for advice on best approach to create a tool which produces desktop notifications when a new...

1 ACCEPTED SOLUTION

Ximizu
Mega Guru

Thanks to my friend Hamza and a conversation I had with my friend Didier, I have finally 2 workarounds to solve the requirement:

1. Use Flow Designer with the action Add Group Users to Task Conversation

or

2. Create a business rule and user the Conversation API

 

Both solutions will create a Connect conversation, which end up notifying the user with a browser notification.

Both solutions have pros and cons.  Let  met explain with this simple use case: Notify the assignment group when the incident priority changes to 1 - Critical.

 

1. Use Flow Designer

Create a Flow with this confiugration

Trigger

Trigger: Created or Updated

Table: Incident [incident]

Condition: Priority | changes to | 1 - Critical

Run Trigger: For each  unique change

Actions

Action: Add Group Users to Task Conversation

Task Record [incident]: Trigger -> Incident Record

Group  [group]: Trigger -> Incident Record -> Assignment Group

Result

 

Pros

Really easy to set up (no code confiugration).

The conversation is linked to the target record.

Cons

The delay to display the browser notification is variable. Average, 10 seconds, but sometimes is 20 seconds, sometimes, 3 seconds...

 

2 Create a Busines rule and use the  Conversation API

 

Create a business rule with this configuration

When: After Insert / Update

Condition: Priority | changes to | 1 - Critical

Script:

//initiate conversation with incident number as conversation name
	var conversation = sn_connect.Conversation.create({
		name: current.getValue('number'),
		type: "connect"
	});
	
	//Retrieve active members of the assignment group
	var groupMember = new GlideRecord('sys_user_grmember');
	groupMember.addQuery('group', current.getValue('assignment_group'));
	groupMember.addQuery('user.active', true);
	groupMember.query();
	
	//Add each member to the conversation
	while(groupMember.next()) {
		conversation.addSubscriber(groupMember.getValue('user'));
	}
	
	//Add the link of incident in the conversation
	conversation.sendMessage({
		body: current.getLink(),
		field: 'system'
	});

 

Result

Pros

No delay to display the browser notification (almost instantaneous!).

Cons

Need scripting skills to do the setup.

The conversation is not linked to the target record

 

Conclusion

If you requirement is to have an instant browser notification (because it is critical for the business to go this fast), go with the business rule solution.

Otherwise,  if  it is  okay to have a 10 seconds  delay, go for the Flow Designer solution.

View solution in original post

10 REPLIES 10

Hi ,

 

Can we implement same workaround for Agent Workspace chat instead of connect?

Becasue currently we have only alert message in AWS homepage when a new chat request is coming...SO if support agent is in another page, he wont be aware about the incoming chat request...Please help.

Hi Saranya, actually I never used Agent Worspace chat. I don't have the answer.

Hi, 

In 2 nd method, only BR  is required? or any other configurations?

 

I used the solution for Flow Designer and it worked Great!  I needed to modify it to only notifiy the assigned user and made the changes noted below but it still seems to be going to the whole group.  Any ideas?

 

find_real_file.png

Akshat Rastogi
Giga Contributor

Hi Ximizu,

 

Any idea how we can post system message through this solution? As you can see the notification which gets generated doesnt give proper description telling that P1 incident has been created instead it gives notification when a new group chat has been created.

field: 'system'

The above attribute doesnt create a system message.