Skip to content
Dynatecon Solutions

Dynatecon Solutions

Let's talk about quick and affordable digital transformation

  • HOME
  • ABOUT US
    • WHAT WE DO
    • OUR WORK
    • OUR CLIENTS
  • PRODUCTS
    • Microsoft 365
    • Dynamics 365 Business Central
    • Dynamics 365 Sales
    • Dynamics 365 Customer Service
    • Dynamics 365 Human Resources
    • Power BI
    • Power Automate
    • Power Apps
  • SERVICES
    • Digital Transformation
    • DynaTectice™
    • Modernize Workplace
  • PARTNERS
  • CONTACT US
  • BLOG
  • CAREERS

Transfer the chat to live agent only if the agent is available

Written by Amal Joy

Posted on 20 Jan 2022

Omnichannel for Customer Service is a robust application that extends the power of Dynamics 365 Customer Service to enable organizations to instantly connect and engage with their customers via channels like Live Chat and SMS.

Fig. 1

When a customer initiates a chat with any of the mode, the chat directly lands in Omnichannel dashboard. Once the chat is initiated in Omnichannel dashboard, a human agent takes it up. We can reduce the involvement of human agents by adding a Power virtual agent so that human agents can deal with more complex cases and enquiries.

We can design a power virtual agent bot and bring it to Omnichannel. The bot can take care of basic enquiries like working hours, price enquiry etc and more. For most of the customer services there will be a working hour. In our case the human agent will be available in the working hours which is between 9 AM and 5 PM. In this blog we are dealing with a specific scenario that the Power virtual agent must look for a human agent before transferring. In order to do that the enquiry time must be captured and should be checked if it is between the available time interval.

The transferring of chat from bot to agent takes place when there is a trigger. Once the customer invokes the trigger phrase, before transferring to human agent a Power automate flow can be called. In this flow the time conditions can be checked and necessary decisions can be taken.

Flowchart

Fig. 2

How to Transfer the chat to live agent only if the agent is available

Step 1: Create a chat bot and specify the escalation topics.

When the customer demands to speak with a human agent, before transferring to agent add ‘call an action’ step and add a power automate flow.

Fig. 3

Step 2: Create a Power automate flow to check if the current time is between working hours.

Initialise a variable to store agent status.

Fig. 4

Add an action ‘Current Time’ as shown in the below figure.

Fig. 5

The time obtained from this step will not be Indian standard time, so it must be converted to IST.

Convert the time obtained to IST

For that add a step called ‘Convert Time Zone’.

Give the output from the previous step as Base time input, we need the time in 24Hr format hence ‘HH:mm’ is given in Format string field. Source time zone can be selected as Coordinated Universal Time from the dropdown. And the Destination time zone can be selected as IST from the dropdown.

Fig. 6

Initialize a variable to store current time.

Fig. 7

The time obtained will be of the format ‘HH:mm’ (24Hr) but in string datatype. In order to perform comparison operation, integer datatype would be a better option.

Add compose action to get only the hour value.

Fig. 8

In the inputs, add the given expression ‘formatDateTime(variables(‘varCurrenttime’),’HH’)’ which extracts only the hour from the ‘HH:mm’ format.

For example if the current time is 2:15 PM, which is 14:15 in 24 Hr format, then the output will be “14”.

Add compose action to convert hour to integer format.

Fig. 9

Give the expression ‘mul(int(outputs(‘Get_Hour’)),100)’. It converts the hour in string format to integer format. The result is multiplied with 100 for easier comparison of time.

If current time is 1 PM, which is 13:00 in 24 Hr format, then the output after this step will be 1300.

Add compose action to get only the minute value.

Fig. 10

In the inputs, add the given expression ‘formatDateTime(variables(‘varCurrenttime’),’mm’)’ which extracts only the minute from the ‘HH:mm’ format.

For example if the current time is 2:15 PM, which is 14:15 in 24 Hr format, then the output will be “15”

Add compose action to convert minute to integer format.

Fig. 11

Give the expression ‘int(outputs(‘Get_Minute’))’. It converts the minute in string format to integer format.

Add compose action to get the time in integer format.

Fig. 12

In the inputs give the expression ‘add(outputs(‘Convert_hour_to_Integer’),outputs(‘Convert_min_to_integer’))’ which adds the hour and minute and output the result. For example if the current time is 2:35 PM then the output obtained after this step will be 1435.

Add a condition action

Fig. 13

In our case the working time is 9AM to 5PM. So, the condition will be true only if the current time is between 9 AM and 5 PM and in all other times the condition will be false.

Set variables for both True and False conditions

Fig. 14

Already a variable was declared to store the status of agent. If the condition is true then set “Will fetch an agent” to the variable. If the condition is false then set “No agents are available” to the variable.

Return the variable to Power virtual agent

Fig. 15

In the final step add an output and pass the variable. Here ‘agentOutput’ is the variable passing to the bot.

Step 3: Select the previously created flow as action.

Fig. 16

From above figure (Fig. 16) it is clear that the power automate is returning a variable agentOutput. On checking the value present in the variable ‘agentOutput’ further decisions can be made.

Step 4: Add a condition to check the value of the variable returned by power automate flow.

Fig. 17

If the string present in the variable ‘agentOutput’ is “Will fetch an Agent” it implies that the enquiry is within the working hours hence it can be transferred to a human agent. Else if the string present in the variable ‘agentOutput’ is “No agent available now” then the chat must be ended.

In the figure below (Fig. 18) we can see that the enquiry is made at 1:28 PM which is within the working hours, therefore the chat will be transferred to a queue.

Fig. 18

In the below figure (Fig. 19) the enquiry is made at 6:39 pm which is after working hours. So, the chat bot displays “Sorry Agent is not available currently” message.

Fig. 19

Related

Posted in Dynamics 365, Omni-channel Engagement Hub, Power Automate
Tagged chatbot, Dynamics 365 omnichannel, Power Automate

About the Author: Amal Joy

View all posts by Amal Joy

Post navigation

Previous Entry Dynamics 365 form level notification using JavaScript
Next Entry Create Lead with chatbot using Power Automate

OUR CREDENTIALS!

Recent Posts

  • How to upload an image/file from canvas app to a SharePoint document library and display it in the Document section of model driven app (via Server side Synchronization)
  • How to show internal error message details in the Power Apps Portal
  • Format Date Using Date Filter for Tables in Power Apps Portal
  • Exception handling in Power Automate
  • Power Pages vs PowerApps Portals

Subscribe our FB page for notifications

Subscribe our FB page for notifications

Enter your email address to follow Dynatecon blog and receive notifications of new posts by email.

Top Posts & Pages

  • Dynamics 365-Get and Set Lookup Field values using Java Script
  • Call HTTP Request from Canvas Power App using Power Automate Flow and get back Multiple Rows as Response
  • Set Default Value vs Set Field Value in Business Rule – Dynamics 365 CE
  • Delete confirmation Dialog in PowerApps Canvas App
  • Call Custom Page with parameters from Model Driven App - Using New Command Editor

CRM 2011 JScript CRM Providers Dynamics 365 Interview Questions Microsoft CRM 2011 Microsoft CRM 2013 Microsoft CRM 2015 Microsoft Dynamics MS CRM 2011 Training Power Platform

DYNATECON Tweets

My Tweets

Tags

Case Study CRM 2011 JavaScript CRM 2011 Training Dynamics 365 Dynamics 365 Sales Dynamics CRM Interview Questions Dynatecon Case Study Microsoft CRM Microsoft CRM 2016 Microsoft CRM Interview Questions Oracle CRM Oracle CRM Interview Questions Power Automate Siebel CRM Siebel CRM Interview Questions
2023 Dynatecon Solutions
  • HOME
  • ABOUT US
  • PRODUCTS
  • SERVICES
  • PARTNERS
  • CONTACT US
  • BLOG
  • CAREERS
Website Powered by WordPress.com.
  • FB
  • Linkedin
  • Twitter
  • Contact Us
  • Follow Following
    • Dynatecon Solutions
    • Already have a WordPress.com account? Log in now.
    • Dynatecon Solutions
    • Customize
    • Follow Following
    • Sign up
    • Log in
    • Copy shortlink
    • Report this content
    • View post in Reader
    • Manage subscriptions
    • Collapse this bar
 

Loading Comments...