chat queue routing

abhinav_khanna
Kilo Expert

Hi all,

 

On the ess portal I want to give a custom link on the page which when clicked opens up the "chat" dialog box and the chat is routed to the correct assignment group based on the users country.
Any idea how to achieve that. I can not hard code the sys_id in the chatqueue function. I want something dynamic which pops up the end user chat on Click.

 

 

Regards
Abhinav Khanna

1 ACCEPTED SOLUTION

TrevorK
Kilo Sage

My initial thought would be that you want to create an "inbetween" piece that either accepts their country as input or takes one from their profile. This piece then redirects to the appropriate Chat Queue based on the result.



While I am not a CMS expert, my thoughts are that a simple way to do this would be through a dynamic content block. The user would enter their country (defaults to their profile country maybe?) and click Chat. The code in the background would then determine the appropriate Chat Queue to send it to and then just redirect to the chat queue link.



We only have one Chat Queue, and we fire it through our dynamic content block in this fashion:


      CustomEvent.fire(LiveEvents.LIVE_EVENT, LiveEvents.LIVE_WINDOW_JOIN_QUEUE_QUERY, 'CHAT_QUEUE_SYS_ID','CHAT_QUEUE_NAME');


I see no reason why there could not just be a little logic before to determine which Chat Queue to fire into.



On the surface, this does not seem too challenging to develop from a technical point of view, however what will be challenging is the UI/UX around this feature.



I am sorry I do not have the code developed for this, as we only use the one Chat Queue but I hope this helps. If you need anything else please post back.


View solution in original post

56 REPLIES 56

Hi John,



I just didnt get time to optimize the code .I am attaching it here. Instead of using single hardcoded sys_id you can always query the chatqueue table and make the code really dynamic.



<code here ... sorry its a mess>




<div style="padding-top:100px">


<div style="margin:0;padding:1px 4px;" class="live_workqueue_button cms_menu_vertical_blocks_container">


<g2:evaluate>


var user = new GlideRecord('sys_user');


user.addQuery('sys_id',gs.getUserID())


user.query();


user.next();


var language = user.preferred_language;


if(language == "")


{


language = "en";


}


var lsa = user.u_local_service_agreement;


</g2:evaluate>


<j2:if test= "$[lsa == 'b6baca5c389d2500acb1a8940d55f2be']" >


<j2:if test= "$[language == 'de']">    


    <a href="#" onclick="CustomEvent.fire(LiveEvents.LIVE_EVENT, LiveEvents.LIVE_WINDOW_JOIN_QUEUE_QUERY, 'c54f0abf0a0a0b452db84664f409c79c', 'Help Desk Chat'); return false;">




          <table>


                <tbody>


                      <tr>


                            <td style="vertical-align:middle;">


                                  <span class="i32 i32_support"></span>


                            </td>


                            <td style="vertical-align:middle;white-space:nowrap;" class="cms_menu_vertical_blocks_title">


                                  <span class="cms_menu_vertical_blocks_title"><h2>Help Desk Chat</h2></span>


                            </td>


                      </tr>


                </tbody>


          </table>


    </a></j2:if></j2:if><j2:if test= "$[lsa == '042bcadc389d2500acb1a8940d55f2dd']" >


                            <j2:if test= "$[language == 'en']">                        


    <a href="#" onclick="CustomEvent.fire(LiveEvents.LIVE_EVENT, LiveEvents.LIVE_WINDOW_JOIN_QUEUE_QUERY, '744546e71c752500ea9817326f46dbb8', 'Help Desk Chat'); return false;">




          <table>


                <tbody>


                      <tr>


                            <td style="vertical-align:middle;">


                                  <span class="i32 i32_support"></span>


                            </td>


                            <td style="vertical-align:middle;white-space:nowrap;" class="cms_menu_vertical_blocks_title">


                                  <span class="cms_menu_vertical_blocks_title"><h2>Help Desk Chat</h2></span>


                            </td>


                      </tr>


                </tbody>


          </table>


    </a></j2:if></j2:if>




<j2:if test= "$[lsa == '042bcadc389d2500acb1a8940d55f2dd']" >


                            <j2:if test= "$[language == 'de']">                        


    <a href="#" onclick="CustomEvent.fire(LiveEvents.LIVE_EVENT, LiveEvents.LIVE_WINDOW_JOIN_QUEUE_QUERY, '070c8c0887ca2500acb1381c89434d83', 'Help Desk Chat'); return false;">




          <table>


                <tbody>


                      <tr>


                            <td style="vertical-align:middle;">


                                  <span class="i32 i32_support"></span>


                            </td>


                            <td style="vertical-align:middle;white-space:nowrap;" class="cms_menu_vertical_blocks_title">


                                  <span class="cms_menu_vertical_blocks_title"><h2>Help Desk Chat</h2></span>


                            </td>


                      </tr>


                </tbody>


          </table>


    </a></j2:if></j2:if>




<j2:if test= "$[lsa == 'b6baca5c389d2500acb1a8940d55f2be']" >


                            <j2:if test= "$[language == 'en']">                        


    <a href="#" onclick="CustomEvent.fire(LiveEvents.LIVE_EVENT, LiveEvents.LIVE_WINDOW_JOIN_QUEUE_QUERY, '39dc0c0887ca2500acb1381c89434d35', 'Help Desk Chat'); return false;">




          <table>


                <tbody>


                      <tr>


                            <td style="vertical-align:middle;">


                                  <span class="i32 i32_support"></span>


                            </td>


                            <td style="vertical-align:middle;white-space:nowrap;" class="cms_menu_vertical_blocks_title">


                                  <span class="cms_menu_vertical_blocks_title"><h2>Help Desk Chat</h2></span>


                            </td>


                      </tr>


                </tbody>


          </table>


    </a></j2:if></j2:if>


</div>


</div>




Regards
Abhinav Khanna


Hi Abhinav,



Great, thank you for sharing.



Cheers,



John


Hi Abhinav,



We also have implemented same functionality but would like to customize this according to user's timezone.


We have created one module "Live chat" in that link type is   "URL(from arguments)". but now the question is we want to pass two queues sys_id there with respect to user's time zone. and I am not getting how to achieve this shall I use script include for this ?



Thanks& Regards,


Neha Joshi


Been a while i have done this but I think you can pass the arguments in the "myUserObject.getTZ()"


You could build out the URL in a script include and then call the function in the arguments. Try it and let me know if it works? Otherwise, I will try and mock something up. A little out of touch with my scripting skills


Hi Abhinav,


I was trying this but couldn't complete it attaching scenario and will be telling how we are using this live chat options


1)Live chat using module.


2)On homepage.


I have created script include and on load client script for this but I think module link type is not proper (plz guide me how to give module link type in this case)


screenshots.



find_real_file.png