Notifications

20 views

Description

Agent Presence Histories table not creating records when agents go into "Available" state, it only records when Away or Offline.


Logs show below error:

JavaScript evaluation error on:
(function executeRule(current, previous /*null when async*/) {

var agent = current.getValue('agent');
var presence = current.getValue('current_presence_state');
var channels = [];
var gr = new GlideRecord('awa_agent_channel_availability');
gr.addQuery('agent', agent);
gr.addQuery('presence_state', presence);
gr.addQuery('available', true);
gr.query();
while(gr.next()) {
if(channels.indexOf(gr.getValue('service_channel')) == -1) {
channels.push(gr.getValue('service_channel'));
}
}
var grHistory = new GlideRecord('awa_agent_presence_history');
grHistory.initialize();
grHistory.setValue('agent', agent);
grHistory.setValue('presence_state', presence);
grHistory.setValue('available_channels', channels);
grHistory.insert();

})(current, previous);
Root cause of JavaScriptException: java.lang.NullPointerException
: java.lang.NullPointerException:

Release or Environment

All supported

Cause

awa_agent_channel_availability table contains records where the "Service Channel" column is empty. This column should always contain a value that corresponds to one of the Service Channels.

Resolution

- Navigate to https://instance_name.service-now.com/awa_agent_channel_availability_list.do?sysparm_query=service_channel%3DNULL&sysparm_view=
- Remove these records

Once completed, you can remove the filters from the list and you will see that the remaining records have a value on the Service Channel column and Agent Presence history will be populated correctly.


Article Information

Last Updated:2020-07-01 07:48:30
Published:2020-07-01