Example configure MS Flow for last agent routing


This example shows you how you can use Microsoft Flow for Last Agent Routing.


Step 1: Prepare the UCC for LastAgent Routing

The following steps are required to use Last Agent Routing within a UCCUCC stands for Unified Contact Center and consists of a queue that can be handled by Agents Each Contact Center has its own settings, interactive voice response questions and Agent with specific skills. Agents can be member of, or sign up to, one or more Contact Centers..

Step 1.1: Activate WriteSummaryToSharePoint

  1. In the UCC that should have Last Agent Routing enabled, go to the list “Settings”. Add a new item (or edit the existing item) with title “WriteSummaryToSharePoint” and set the value to “true”.
  2. From now on every call that is managed by the UCC will write a summary of this call to the list “CallSummary”.


Step 1.2: Create Skills

  1. Create a Skill for every single Agent and link this Skill to the specific Agent. It is advised to use an Availability- ,CountDown- or a CountDownAvailability Skill, so an escape is possible if the Agent is not able to answer the call.


Step 1.3: Create IVR Questions

  1. Create an IVRInteractive Voice Response (IVR) is a telephone application to take orders via telephone keypad or voice through a computer. By choosing menu options the caller receives information, without the intervention of a human operator, or will be forwarded to the appropriate Agent. Question for every single Agent with Title “Question sipThe Session Initiation Protocol (SIP) is a protocol to make multimedia communication (audio, video and other data communication) possible and it is also used for Voice over IP (VoIP). SIP has similarities with other Internet protocols such as HTTP and SMTP.:<SIP address” and Skill<specific agent skill (as generated in previous step).

    Note that the “WelcomeMessage” has the fallback skill of the individual Agent Skills.

  2. So if a customer calls for the first time one of the three Agents of this UCC will answer the call. If a customer calls for the second time, the call will be forwarded to the IVRQuestion of a specific Agent; if the agent is not able to answer the call itwill be offered to another Agent (using the escape).


Step 2: Create a Microsoft Flow

  1. From your Office Portal, go to your Flow App:

  2. Click "My Flows":

  3. Click "New" and "Create from Blank":

  4. Select connector "SharePoint, When an item is created":

  5. When call is ended and entry is written in CallSummary list

  6. Get all parent questions that match ‘Question <sipaddress agent>’

    concat('Title eq ''Question ',triggerBody()?['wsp_ucc_InitialAgent'],'''')

  7. Compose a variable to count the number of matching IVR Questions


  8. If a total of 1 IVR Question is found continue

  9. Get routing items that match customer

    If customer called using phone convert phone number into sip address; otherwise use customer sip address

    tel:+31123456789 => sip:+31123456789@domain.com

    sip:customer@domain.com => sip:customer@domain.com

    if(equals(substring(triggerBody()?['wsp_ucc_Customer'],0,3),'tel'),concat('wsp_ucc_routing_match_from eq ''','sip:',substring(triggerBody()?['wsp_ucc_Customer'],4,sub(length(triggerBody()?['wsp_ucc_Customer']),4)),'@domain.com'''),concat('wsp_ucc_routing_match_from eq ''',triggerBody()?['wsp_ucc_Customer'],''''))

  10. Compose a variable to count the number of matching Routing Items


  11. If number of Routings found is 0 continue

  12. For each IVR Question found (which is limited to 1 by the first condition in this flow)

  13. Create a Routing Item


    concat('Customer ', triggerBody()?['wsp_ucc_Customer'])

    Match From:


    Action Value: Question

    Active: Yes

    ExactMatch: Yes

    PartenQuestion Id: items('Apply_to_each')['ID']

    MatchEndpoint: ALL

    Order: 1

    Content type Id: UCCRouting

  14. (Optional) Finally, remove the call summary item that triggered the flow



If all steps are followed, you will have the following flow: