cancel
Showing results for 
Search instead for 
Did you mean: 

Power Virtual Agent integration with Dynamic 365 CRM using Power Automate

Power Virtual Agent integration with Dynamic 365 CRM using Power Automate

In this article we are going to see how Power Virtual Agent, Power Automate and Dynamic 365 CRM combine to do wonders!

To demonstrate, I have taken a scenario of broadband Internet provider company extending their effective customer support using Virtual Agent Service.

I have captured few real times scenarios of the services provided by the internet provider company like:

  • Request for a new connection
  • Broadband related Queries
    • Internet not working.
    • Account details.
    • Check service ticket status.

When user starts the conversation with greeting phrase like Hi, Hello, Good Morning etc. Immediately virtual agent responds the user to select the below option:

  • Need a new connection
  • Broadband related queries.

01_Screen.jpg

New Internet Connection Process Branch:

Customer is requesting for new internet connection

Power Virtual Agent:

Step 1:

Virtual agent asks a details to the user like:

  • Enter Name
  • Enter Email
  • Enter Mobile Number
  • Enter Flat/House No/Building
  • Enter Zip or postal code

02_Screenshot.jpg

Virtual agent stores the user entered details in the variables (named as name, mobile, zipcode, email, streetaddress) to create a lead in Dynamic 365 CRM using power automate against user request.

Step 2:

Based on user entered details in virtual agent, we need to create lead record in Dynamic 365 CRM. For this I have created power automate named as lead creation flow to create lead record in the CRM.

To trigger lead creation flow from virtual agent, I have added call an action node where all created power automate is listed out.

Important:

  • Virtual agent and power automate should be in same environment.
  • Power automate should be created under solution in same environment.

If the above key points are followed, call an action node in virtual agent will list out all power automate name which is created in same environment.

04_Screen.jpg

Call an action node is added and select lead creation flow. Lead creation flow gets five inputs and gives one output. select and provide the appropriate variable (like Name, Email, StreetAddress, Mobile, Zipcode) for each of the inputs. Similarly, select the output variable from flow to send the response from flow to the user.

04_Screenshot.jpg

Base on the inputs, lead creation flow creates a lead record in the Dynamic 365 CRM.

Step 3:

On successful creation of lead in Dynamic 365 CRM, the output response from Lead creation flow is feed to the message node in the virtual agent and displayed to the user.

05_Screenshot.jpg

Step 4:

End with survey node is added to end the branch.

06_Screenshot.jpg

Power AutomateLead creation flow

Step 1:

Power virtual agents action is used to trigger the flow from the virtual agent based on the user input like name, email, mobile number, etc.

07_Screenshot.jpg

Step 2:

CDS Create a new record action is used to create lead record by passing essential details like Name, email, mobile number etc.

08_Screenshot.jpg

Step 3:

Successful creation of lead records, greetings email has been sent to the user.

09_Screenshot.jpg

Step 4:

Return value to power virtual agent action as key “LeadCreationResp” and value “Thanks for choosing ABC Internet Provider. Our representative will contact you shortly.” that will be sent as an output to the virtual agent.

10_Screenshot.jpg

New Internet Connection Process in Action:

New Connection Bot Flow.gif

Customer will get the email notification:

New broadband connection email.jpg

Broadband related queries Branch:

Before offering service to customer, virtual agent prompts the user to enter mobile number to check whether user is existing customer or not.

User Authentication process:

Power Virtual Agent:

Step 1:

Ask a question node is added to display the message “As a process of authentication, I would require you to provide your 10 digit mobile number” to the user and ask them to enter it.

12_Screenshot.jpg

Step 2:

To check the entered mobile number is existing customer or not in the CRM system.

Call an action node is added and selected power automate named as Authentication flow. Authentication flow gets one inputs and gives two outputs. select and provide variable (PhoneNumber) as an input. Similarly, select the output variable from flow to send the response from flow to the user.

13_Screenshot.jpg

Based on the response from flow, the condition branch is further divided in to:

  • User Authentication Fail branch.
  • User Authentication success branch.

Power AutomateAuthentication Flow

Step 1:

Power virtual agents action is used to trigger the flow from the virtual agent based on the user input.

14_Screenshot.jpg

Step 2:

CustomerID and EmailAddress Variables are initialized to store customer account record GUID and email.

15_Screenshot.jpg

Step 3:

CDS list records action is used find out customer account based on the applied filter by customer mobile number.

16_Screenshot.jpg

Step 4:

Check whether length of the record count is equal to 1.

Step 5:

Condition action is added to check the record counts. If record count is equal to 1 then CustomerID variable is set to customer account record GUID and EmailAddress variable is set to customer email id. Else if record count is not equal to 1 then the variable is set to “NotFound”.

The below expression is used to check the output of the list record length is equal to 1

length(outputs('List_records')? ['body/value'])

17_Screenshot.jpg

Step 6:

Return value to power virtual agent action send the customer account record GUID and email address value to be stored in variable in virtual agent action.

18_Screenshot.jpg

User Authentication Fail Branch:

Power Virtual Agent:

Step 1:

If user record is not found in the CRM systems.

19_Screenshot.jpg

Step 2:

“Oops! There is no such account registered with us. Kindly try again later” message is feed to Message node in the virtual agent and displayed to the user.

20_Screenshot.jpg

Step 3:

End with survey node to end the branch.

21_Screenshot.jpg

User Authentication Fail Branch in Action:

Phone number Authentication failure.gif

User Authentication Success Branch:

Power Virtual Agent:

Step 1:

Based on customer account record found in the CRM system. Virtual agent offers three type of service to customer.

  • Internet not working
  • Account details
  • Check service ticket status

22_Screenshot.jpg

Note:

From customer account records, we have stored account record GUID and email address in virtual bot to perform the above mention operation. For example, customer account record GUID is essential attribute to create a case against the customer in the CRM system. Once case record is created, using customer email address, email notification is sent to the customer.

User Authentication Success Branch in Action:

Phone number Authentication success.gif

Internet not working Branch:

Power Virtual Agent:

If User has chosen an internet not working option.

23_Screenshot.jpg

Step 1:

Ask a question node is added to display the message “Enter the issue” to the user and ask them to enter it.

24_Screenshot.jpg

Step 2:

Call an action node is added and selected case creation flow. Case creation flow gets three inputs and gives one output. Select and provide the appropriate variable (like User ID, Email, and issue description) for each of the inputs. Similarly, select the output variable from flow to send the response from flow to the user.

25_Screenshot.jpg

Step 3:

On successful creation of case in Dynamic 365 CRM, the output response from Case creation flow is feed to the message node in the virtual agent and displayed to the user.

26_Screenshot.jpg

Step 4:

End with survey node is added to end the branch.

27_Screenshot.jpg

Power AutomateCase Creation flow

Step 1:

Power virtual agent action is used to trigger the flow from the virtual agent based on the user input.

28_Screenshot.jpg

Step 2:

CDS create a new record action to create case in CRM system based on the input parameters like issue description, user ID (case is created against user account).

By default, we have set few attribute values which is mentioned below:

Case Title: “Internet is not working”

Origin: “Virtual Bot”

Case Type: “Problem”

29_Screenshot.jpg

Step 3:

Send an email notification action is added to send email to user about case details like case ticket number etc.

30_Screenshot.jpg

Step 4:

Return value to power virtual agent action send the message to be displayed to the user as a response from the bot.

31_Screenshot.jpg

Internet not working Branch:

Internet not working flow.gif

Customer get the email notification:

32_Screenshot.jpg

Account details Branch:

Power Virtual Agent:

Step 1:

If user selected Account details option in virtual agent. Account details branch processes follows

33_Screenshot.jpg

Step 2:

Call an action node is added and selected account details flow. Account details flow gets one inputs and gives one output. select and provide the User ID variable as an input. Similarly, select the output variable from flow to send the response from flow to the user.

34_Screenshot.jpg

Step 3:

The output response from Account details flow is feed to the message node in the virtual agent and displayed to the user.

35_Screenshot.jpg

Step 4:

End with survey node is added to end the branch.

36_Screenshot.jpg

Power Automate: Account Details flow:

Step 1:

Power virtual agents action is used to trigger the flow from the virtual agent based on the user input.

37_Screenshot.jpg

Step 2:

Initialize variable node is added to initialized and store Account details information in the variable.

38_Screenshot.jpg

Step 3:

CDS list records action is added to find out current purchased items (internet package) against customer. 

39_Screenshot.jpg

Step 4:

Condition action is added to check the record counts. If record count is equal to 1 then accountdetails variable is set to current purchased item against user. Else if record count is not equal to 1 then accountdetails variable is set to "Sorry! No package active found. ".

40_Screenshot.jpg

Step 5:

Return value to power virtual agent action send the message to be displayed to the user as a response from the virtual agent.

41_Screenshot.jpg

Account details Branch:

Account details flow and orderlines.gif

Check service ticket status Branch:

Power Virtual Agent:

42_Screenshot.jpg

Step 1:

Ask a question node is added to display the message “Enter Ticket No” to the user and ask them to enter it.

43_Screenshot.jpg

Step 2:

Call an action node is added and select power automate Ticket flow. Ticket flow gets two inputs and gives one output. select and provide the appropriate variable (like Ticket Number and Email ID) for each of the inputs. Similarly, select the output variable from flow to send the response from flow to the user.

44_Screenshot.jpg

Step 3:

the output response from Ticket flow is feed to the message node in the virtual agent and displayed to the user.

45_Screenshot.jpg

Step 4:

End with survey node is added to end the branch.

46_Screenshot.jpg

Power Automate: Ticket flow

Step 1:

Power virtual agents action is used to trigger the flow from the virtual agent based on the user input.

47_Screenshot.jpg

Step 2:

Initialize variable node is added to initialized and store case status in the variable.

48_Screenshot.jpg

Step 3:

CDS list records action is added to find out case and case status against ticket number entered. 

49_Screenshot.jpg

Step 4:

Condition action is added to check the record counts. If record count is equal to 1 then casestatus variable is set to case status details. Else if record count is not equal to 1 then casestatus variable is set to “We have not found any open complaints”.

50_Screenshot.jpg

Step 5:

Send an email notification action is added to send email to user about case status details.

51_Screenshot.jpg

Step 6:

Return value to power virtual agent action send the message to be displayed to the user as a response from the bot.

52_Screenshot.jpg

Check service ticket status Branch:

Check Service Ticket flow.gif

Customer gets email notification:

53_Screenshot.jpg

Perhaps this article will also give you some inspiration on other ways to make use of Power Automate. 

Meet Our Blog Authors
  • Experienced Consultant with a demonstrated history of working in the information technology and services industry. Skilled in Office 365, Azure, SharePoint Online, PowerShell, Nintex, K2, SharePoint Designer workflow automation, PowerApps, Microsoft Flow, PowerShell, Active Directory, Operating Systems, Networking, and JavaScript. Strong consulting professional with a Bachelor of Engineering (B.E.) focused in Information Technology from Mumbai University.
  • I am a Microsoft Business Applications MVP and a Senior Manager at EY. I am a technology enthusiast and problem solver. I work/speak/blog/Vlog on Microsoft technology, including Office 365, Power Apps, Power Automate, SharePoint, and Teams Etc. I am helping global clients on Power Platform adoption and empowering them with Power Platform possibilities, capabilities, and easiness. I am a leader of the Houston Power Platform User Group and Power Automate community superuser. I love traveling , exploring new places, and meeting people from different cultures.
  • SharePoint, Microsoft 365 and Power Platform Developer | Contributor on SharePoint StackExchange
  • Encodian Owner / Founder - Ex Microsoft Consulting Services - Architect / Developer - 20 years in SharePoint - PowerPlatform Fan
  • I am the Owner/Principal Architect at Don't Pa..Panic Consulting. I've been working in the information technology industry for over 30 years, and have played key roles in several enterprise SharePoint architectural design review, Intranet deployment, application development, and migration projects. I've been a Microsoft Most Valuable Professional (MVP) 12 consecutive years and am also a Microsoft Certified SharePoint Masters (MCSM) since 2013.
  • Big fan of Power Platform technologies and implemented many solutions.
  • Passionate #Programmer #SharePoint #SPFx #Office365 #MSFlow | C-sharpCorner MVP | SharePoint StackOverflow, Github, PnP contributor
  • Web site – https://kamdaryash.wordpress.com Youtube channel - https://www.youtube.com/channel/UCM149rFkLNgerSvgDVeYTZQ/