Routing chat based on user's country location.

vps
Tera Contributor

My client wants to route chat to different chat queues based on the country location of the user.

Any Idea. how to do it?

 

Thanks!

 

1 ACCEPTED SOLUTION

Muralidharan BS
Mega Sage
Mega Sage

Hi There,

Within the topic you can configure the queues for the live agent transfer. You can validate the location of user and connect to live agent. 

example script [working - tested]

var location = vaInputs.user.location.getDisplayValue();

if(location == 'India'){
    vaVars.LiveAgent_queue = 'f4d701b1b3900300f7d1a13816a8dc8e';
    gs.info('India location')
    vaSystem.connectToAgent();
}

 

Thanks

View solution in original post

9 REPLIES 9

Muralidharan BS
Mega Sage
Mega Sage

Hi There,

Within the topic you can configure the queues for the live agent transfer. You can validate the location of user and connect to live agent. 

example script [working - tested]

var location = vaInputs.user.location.getDisplayValue();

if(location == 'India'){
    vaVars.LiveAgent_queue = 'f4d701b1b3900300f7d1a13816a8dc8e';
    gs.info('India location')
    vaSystem.connectToAgent();
}

 

Thanks

I am getting below error

 

org.mozilla.javascript.EcmaError: "vaVars" is not defined.
Caused by error in sys_script.e572da64db3f581051c7e25cd3961973.script at line 12

9: if (gr.next()) {
10: 
11: if (gr.u_work_country.getDisplayValue() == 'Australia') {
==> 12: vaVars.LiveAgent_queue = '86c9d160dbfb981090c9f264f3961985';
13: vaSystem.connectToAgent();
14: }
15: }

Try vaSystem.LiveAgent_queue.

Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

HI There,

As Mark commented can you try vaSystem instead of vaVars.

 
vaSystem.LiveAgent_queue = 'sys id of 'chat_queue'';

I tired with vaVars it just works for me and I dont have any variables added,

can you check in collaboration > chats setup, click Context and verify you have - queue (liveagent_queue) present. 

And, check if there is a record present here - 

https://instance.service-now.com/sys_cs_topic_list.do?sysparm_query=name%3D_live_agent_support_&sysparm_view=

 

Thanks

Hi Muralidharan,

 

Can you please confirm where we have to configure this script ? Is it in Topic table Business rule or any other table?

 

Regards,

Manoj S