Availability API

The DE Apex API includes methods to get and set user availability. 

Get Availability (Team)

global static Map<Id, Map<Id, Boolean>> getUserAvailabilityAllTeams()

Returns online status for every Salesforce user in a DE team. Users can be a member of more than one DE team, each with its own hours. So online status can vary per team. This method returns a Map keyed by Team Id, containing a Map of User Id vs online Boolean.


Get Availability (User)

global static Map<Id, Boolean> getAvailabilityByUser(String userId)

For a given Salesforce user Id returns a map of team Id vs online Boolean.


Toggle Users

global static void toggleUsers(List<ToggleUserDTO> toggleUserList)

Toggle a list of users on or offline in Distribution Engine. Pass in a list of ToggleUserDTO objects

ToggleUserDTO(Id userId, Boolean isOnline, String offlineReason)


List<n2de.DistributionEngineGlobal.ToggleUserDTO> userDtoList = new List<n2de.DistributionEngineGlobal.ToggleUserDTO>();
userDtoList.add(new n2de.DistributionEngineGlobal.ToggleUserDTO(UserInfo.getUserId(), true, null));

   Another example is shown in the Omni-Channel Presence Integration article.

   This method is also available to use within a Salesforce Flow under the name "DE Toggle Users" in the category "Distribution Engine"

How did we do?

Example - getAvailabilityByUser