Can we dynamically show "position in queue" to user in virtual agent.

dineshchoudhary
Kilo Guru

I have configured the queue count during a live agent transfer in the Virtual Agent and displayed it as a system message using the script below. However, I am looking for options to dynamically track and update this count in real time. Is there a way to achieve this?

 

(function execute() {
        var VALq = new GlideAggregate('awa_interaction_work_item');
        VALq.addEncodedQuery("wi_active=true^wi_state=queued");
        VALq.addAggregate('COUNT');
        VALq.query();
        if (VALq.next()) {
            var countAgent =  VALq.getAggregate('COUNT');
        }    
        var msg = "Your current queue position is: " + countAgent; 
        vaSystem.sendSystemMessage(msg)
})()

dineshchoudhary_0-1742946015753.png

dineshchoudhary_1-1742946052629.png

 

 

0 REPLIES 0