cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1309
Views
0
Helpful
8
Replies

Not able to get Queue Name using "GetQueue" API function

ravindra999
Level 1
Level 1

I am working on gadget which requires to pass the " Agent  assigned skill group names" to another webservice call.  For that I am trying to get agent skill names using getQueues , but the function getName() is not returning  name of the queue.  Appreciate if anyone has some sample code to get the queue name. 

Here is snippet of my code

_handleQueueLoaded = function(){

   alert("There are " + agentq.length + " queues for this user."); //returns number of queues assigned

     var agentqCollection = agentq.getCollection(),

       queues = [], id, name1, queueInfo, queueRest, data;

     for (id in agentqCollection) {

        queueInfo = agentqCollection[id];

        alert(queueInfo.getName());  //  not able to get name of the skill group name - Failing all the time..

  //As per api, getName() should return the skill group name, but I am not able to get it.

   }

  },

handleUserLoad = function (userevent) {

         agentq = user.getQueues( {

    onLoad : _handleQueueLoaded,

    onError : _handleQueueError

  });

    },

Thanks in advance,

R

8 Replies 8

dlender
Level 6
Level 6

Are you able to get any of the fields? For example queueInfo.getId(); ? Are you getting agentq.length?

Also try using :

_handleQueueLoaded = function (agentq){

}

am getting "agentq.length", but not the required fields I want  "getName()" except   getXMPPNodePath().

var agentqCollection = agentq.getCollection(),

for (id in agentqCollection) {

  queueInfo=agentqCollection[id];

alert(queueInfo.getId());  //Not able to get

alert(queueInfo.getName());  //Not able to get

  alert(queueInfo.getXMPPNodePath());  // able  to get

  }

Appreciate if you could share  any sample code on how to use "getQueues" function in finesse 10.5.1

Thanks,

R.

dlender
Level 6
Level 6

What version of Finesse are you using? What version of the finesse javascript library?

I am using finesse library (finesse-10.5.1.js) and finesse version  Cisco Finesse Administration v10.5(1)

Are you able to login as a supervisor User and see the queues in the QueueStatistics gadget?

Yes, I am able to see the information about skills in "queue statistics"

gadget.

As  I am not able to get skillName using "getQueues" , I tried to get skill name using

  "http://{finesse ip}8080/finesse/api/User/{userId} /Queues".   In the third party gadget, I am using  "gadgets.io.makeRequest"  to get the information.

"gadgets.io.makeRequest("http://{finesse ip}8080/finesse/api/User/{userId} /Queues", handler, params);

But when I make this request , I am getting error " This request need http authentication". 

1. As agent is already logged on Finesse destkop, not sure why we need to send this information again.

2. If we need to send agent username/password, what is the way I can send this information for "gadget.io.makeRequest" requeust?

Thanks,

R.

I don’t think you should be using the Finesse API using gadgets.io.makerequest. You have to send the userid and password authorization encoded in Base64 in order to use the Finesse API. You can see an example of doing this in the nongadgetsample but I don’t think you should be doing this in a gadget.

If you want to see how GetQueue works, look in the debugger at the QueueStatistics.js for that gadget. Since the gadget is working we know the finesse.js is working correctly since QueueStatistics gadget is using the library.

You do know that the user.getQueues API only works for Supervisor agents.

Here is some of the code from the QueueStatistics gadget:

_handleUserLoad = function (user) {

user.getQueues({

onCollectionAdd: _onQueuesAdd,

onCollectionDelete: _onQueuesDelete,

onLoad: _onQueuesLoad,

onError: _onQueuesError

});

},

_onQueuesAdd = function (queue) {

// add the new queue to the datastore and attach onChange handler

queue.addHandler('change', _onQChange);

},

_onQChange = function (q) {

var i;

// first check to make sure the grid is loaded. If it is not, we need to

// just update the array that gets passed into _renderGrid() with the

// updated queue information

if (!_loaded.queueGrid) {

for (i = 0; i < _queues.length; i += 1) {

if (q.getId() === _queues[i].queueid) {

_queues.splice(i, 1, _formatQueue(q));

break;

}

}

} else {

// else, grid is loaded already so we just update the item in the

// grid

_queueObjs.datastore.fetchItemByIdentity({

identity: q.getId(),

onItem: function (item) {

if (item && _queueObjs.datastore.getValue(item, 'queueid') === q.getId()) {

var displayQ = _formatQueue(q);

_queueObjs.datastore.setValue(item, "name", displayQ.name);

_queueObjs.datastore.setValue(item, "callsInQueue", displayQ.callsInQueue);

_queueObjs.datastore.setValue(item, "maxTimeInQueue", displayQ.maxTimeInQueue);

_queueObjs.datastore.setValue(item, "agentsReady", displayQ.agentsReady);

_queueObjs.datastore.setValue(item, "agentsNotReady", displayQ.agentsNotReady);

_queueObjs.datastore.setValue(item, "agentsTalkingInbound", displayQ.agentsTalkingInbound);

_queueObjs.datastore.setValue(item, "agentsTalkingOutbound", displayQ.agentsTalkingOutbound);

_queueObjs.datastore.setValue(item, "agentsTalkingInternal", displayQ.agentsTalkingInternal);

_queueObjs.datastore.setValue(item, "agentsWrapUpReady", displayQ.agentsWrapUpReady);

_queueObjs.datastore.setValue(item, "agentsWrapUpNotReady", displayQ.agentsWrapUpNotReady);

}

}

});

}

},

_formatQueue = function (queue) {

var statistics = queue.getStatistics();

return {

"queueid": queue.getId(),

"name": queue.getName(),

"callsInQueue": _formatStat(statistics.callsInQueue),

"maxTimeInQueue": statistics.startTimeOfLongestCallInQueue,

"agentsReady": _formatStat(statistics.agentsReady),

"agentsNotReady": _formatStat(statistics.agentsNotReady),

"agentsTalkingInbound": _formatStat(statistics.agentsTalkingInbound),

"agentsTalkingOutbound": _formatStat(statistics.agentsTalkingOutbound),

"agentsTalkingInternal": _formatStat(statistics.agentsTalkingInternal),

"agentsWrapUpReady": _formatStat(statistics.agentsWrapUpReady),

"agentsWrapUpNotReady": _formatStat(statistics.agentsWrapUpNotReady),

"talking": "",

"wrapUp": ""

};

},