wave background

Harnessing the strength of Teleopti WFM, Part 2: Updating agent information

Teleopti WFM Software, Understanding Workforce Planning

Once again the blog turns its focus to more technical matters as Robin Karlsson, Technical Lead at Teleopti, offers us the second part in his ‘How best to use Teleopti WFM’s API’ series, focusing on agent information.

agent informationIn the first blog of this series we showcased how to make the initial connection with the API and how to extract some basic agent information. In this second blog, we’ll introduce the concept of making updates to agent information in Teleopti WFM.

To issue an update you’ll mostly use the InternalService.ExecuteCommand() and send in the appropriate command object. The available commands are grouped in a separate namespace in the CHM reference file provided by Teleopti. Each command will require a different set of input parameters defined on the object itself.

Some of the older modification commands are still available as separate functions directly on each service.

You’ll need permissions to open the People tool for the selected agent if you wish to update that agent’s details. Otherwise you’ll receive a ‘permission denied’ exception. The permissions are changed and granted in the Permissions module in the regular Teleopti WFM client.

To update the email address of an agent we first need to input the details and then issue the update. It can be achieved using a simple query to input the agent into the system using the ID we previously got when inputting the whole team and then modify the email address and send the agent’s profile back to the API.

var organizationService = new OrganizationService();
var agent = organizationService.GetPersonsByQuery(new GetPersonByIdQuery { PersonId = “{892B0DB4-415B-45D8-A61A-3E4DB401AB20}” }).First();
agent.Email = “agent.new.email@company.com”;
organizationService.UpdatePerson(agent);

As you can see, organizationService.GetPersonsByQuery() will return a list of people. However, when we use the query GetPersonByIdQuery it will return either 1 or 0 agents as the PersonId is unique. In the example code above, we anticipate that we’re getting one agent back, but you can of course add a check to reveal whether we got an agent in the response.

Another example is to set values in the customizable, optional columns in People. It requires setting more things in place and using the newer InternalService.ExecuteCommand() to change the values. Please note that the column must exist before you can apply the value. If the column or person doesn’t exist, you’ll get an exception back from the API.

var internalService = new InternalService();
var result = internalService.ExecuteCommand(new SetPersonOptionalValuesForPersonCommandDto {PersonId = “{892B0DB4-415B-45D8-A61A-3E4DB401AB20}”,OptionalValueCollection = new[] {new OptionalValueDto {Key = “ShoeSize”,Value = “42”} }});
if (result.AffectedItems == 1)
{
//The update of the optional column value was successful
}

Most of the details in People can be changed in a similar manner. There are also more advanced commands available, for example, ‘modify schedules’ and ‘reflect changes in employment conditions’.

Like for every part of this series you’ll find the sample code on Teleopti’s official GitHub repository available at https://github.com/Teleopti/sdk-sample.

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact me I want to know more