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

sachin_namjoshi
Kilo Patron
Kilo Patron

You can leverage service now notifications for inserting record to notify users for any action items.

Also, you can send reminders for these notifications unless action item is performed.

 

If your users are using mobile app for accessing service now instance, agent app uses Push Notifications OOB for any record created.

 

Regards,

Sachin

Thanks for your answer. For the moment, the customer does not plan to use mobile application, but I will let him know regarding the OOTB Push notifications.

Ximizu
Mega Guru

At this date, ServiceNow does not provide this possibility.

Here the answer I received from /hi.

 

Issue:   You would like to have a browser notification when a new record is inserted into a custom table.

Solution Proposed:   Unfortunately, we do not offer custom browser notifications like that from Connect chats.  You can utilize custom notifications via the settings cog, if you would like.  We have some documentation on this located here:  https://docs.servicenow.com/bundle/newyork-servicenow-platform/page/administer/notification/task/cre...

 

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.