VA - vaSystem.connectToAgent(); : not routing ass expected
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2024 02:58 AM
Hello All,
I recently developed a Virtual Agent (VA). The intended functionality is to route chats to an agent based on the user's location's service desk availability.
For example, if the user's country is India and the service desk for India is in Bangalore, the chat should be routed to the Bangalore service desk.
Here is the script. While it works as expected most of the time, occasionally chats are being routed to the China service desk.
(function execute() {
var locationSchedule = vaInputs.user.location.u_service_desk_schedule;
var userGrp = vaInputs.user.location.u_country_reference.u_service_desk;
gs.info('userGrp is ' + userGrp);
var creationDateTime = new GlideDateTime();
if (userGrp != '') {
var schdAns = new chat_routing_custom().getScheduleSwedengrp(creationDateTime, locationSchedule);
gs.info('schdAns is ' + schdAns);
if (schdAns == true) {
vaVars.LiveAgent_queue = '058f8e9cdb4cb01098f90892f39619fc';
var gr = new GlideRecord('awa_eligibility_pool');
gr.addQuery('agent_assignment_rule', '2f44d210db80f01098f90892f39619f0');
gr.query();
while (gr.next()) {
if (gr.groups == userGrp) {
gs.info('2nd line passed');
vaSystem.connectToAgent();
}
}
} else if (schdAns == 'f1d05fbbdbe0c090774149ee3b96191a') {
gs.log('Inside if 2');
vaVars.LiveAgent_queue = '058f8e9cdb4cb01098f90892f39619fc';
var gr = new GlideRecord('awa_eligibility_pool');
gr.addQuery('agent_assignment_rule', '2f44d210db80f01098f90892f39619f0');
gr.query();
while (gr.next()) {
if (gr.groups == schdAns) {
vaSystem.connectToAgent();
}
}
}
}
})();
Any assistance in resolving the issue would be greatly appreciated.
Thanks and Regards
Kartik Magadum
0 REPLIES 0