cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1110
Views
0
Helpful
5
Replies

Get the team name of agent from a supervisor's view

poonam.menon
Level 1
Level 1

Hi,

I want to list the team name of the team members of a supervisor.I am able to find the first name, last name , state of the agents.But not able to find the team name of the agent.I am using javascript apis for developing this third party gadget. Please help.

Regards,

5 Replies 5

dekwan
Cisco Employee
Cisco Employee

Hi,

How are you getting the first name, last name, and state of the agents? Are you using the getSupervisedTeams method against the supervisor user object? If so, you should be able to get the team name after creating the team object. Please see this thread on how to use the getSupervisedTeams: Re: Supervised Teams getUsers object

Thanx,

Denise

Hi Denise,

Yes, I am using the getSupervisedTeams  to get the details. teamMember.getTeamName(); is the function used to retrieve the team name.  The code used is shown below.

initially,

var supervisedTeams = user.getSupervisedTeams();
for (i = 0; i < supervisedTeams.length; i++) {

   var team = supervisedTeams[i];
   teamObj = new finesse.restservices.Team({

   id: team.id,
   onLoad: _onTeamLoad,
   onChange: _onTeamLoad
   });
}

_onTeamLoad = function (team) {

   users = team.getUsers({

   onLoad: _onTeamUsersLoad,
   onError: _onTeamError
   });
},


_onTeamUsersLoad = function(users) {

   var usersCollection = users.getCollection();
   for (var userId in usersCollection) {

   var teamMember = usersCollection[userId];
   var userFirstName = teamMember.getFirstName();
   var userLastName = teamMember.getLastName();
   var agentId = teamMember.getId();
   var userTeamName = teamMember.getTeamName();
   var userState = teamMember.getState();

   superTeamTable += '<tr class="fs-team" id="'+agentId+'" data-agent-id="'+agentId+'"><td>'+userFirstName+'</td><td>'+userLastName+'</td><td>'+agentId+'</td><td>'+userState
   +'</td><td>'+ userTeamName+'</td></tr>';

  usersCollection[userId].addHandler('change', _onTeamUserChange);
   }

  $("#pop-tab").html(superTeamTable);
   gadgets.window.adjustHeight();
   render();
}

Please help to get the team name of each agent.Currently the value of teamname  is coming as "undefined".

Hi,

teamMember.getTeamName() is not a valid method because the User object only has the team id's. You would need to get the team name from teamObj.getName(). You can't get it from the User object, because a user can be part of multiple teams.

https://developer.cisco.com/docs/finesse/#user

Thanx,

Denise

poonam.menon
Level 1
Level 1

Hi,

I need to capture the team name that the agent belongs to under a particular supervisor.

Can you please help me understand the  difference between user.getTeamName()  where user is userObj

user = new finesse.restservices.User({

   id: cfg.id,
   onLoad : handleUserLoad,
   onChange : handleUserChange
});

and teamObj.getName().

Oh sorry. I didn't realize that there was a getTeamName() for the user object. I retract what I had said previously about user.getTeamName not existing.

You said that teamMember.getTeamName(); is undefined, I suggest using the browser's developer tools to see what the teamMember object looks like. Is there anything in the teamName? How does the User event look like? Is the team name there?


Thanx,

Denise