CRM Crate

Embed a Power Virtual Agent (Bot) into the Dynamics 365 form

We will learn to embed a Power Virtual Agent (Bot) into the Dynamics 365 entity form. Before we start, make sure to subscribe to CRM Crate so that you stay up-to-date in the field of Dynamics 365 CRM.

Embedd a Power Virtual Agent (Bot) into the Dynamics 365 entity form

What are Power Virtual Agent?

Power Virtual Agents lets you create intensely powerful chat bots that can answer questions posed by your customers, other employees, or visitors to your website or service.

Below are few ways where the PVA (Chat Bots) can be utilized: –

  • Common employee questions for businesses
  • COVID-19 infection rate and tracking information
  • Employee health and vacation benefits
  • Opening hours and store information
  • Sales help and support issues

Power Virtual Agents is available as both a standalone web app, and as a discrete app within Microsoft Teams. 

Click on the given link to understand the pricing structure of the Power Virtual Agents –

Why do we need Power Virtual Agents in Dynamics 365?

Consider a business scenario where we need to guide the end users according to their respective queries. We can achieve this requirement by creating, configuring and embedding the Power Virtual Agent chat box in Dynamics 365 form using the below given procedure.

Create & design a new Power Virtual Agent –

Lets create a new PVA chatbot for free under the Microsoft Trial licensing capability.

  • Open the PVA studio ( and login with a business user account (You cannot use personal user accounts such as Gmail, Hotmail, Yahoo etc).
  • Later, select the 30 days trial plan and proceed ahead.
  • Once you are successfully logged-in, navigate to the home page and click on the Bot button as shown below.
  • Click on +New bot, provide the basic details such as bot name, language of operation and dataverse and click on create as shown below.
  • Before proceeding ahead, let us first understand few fundamentals of PVA. Below is the overview of the components used in Power Virtual Agents.

Topics –

In Power Virtual Agents, a topic defines how a chatbot conversation plays out. You can author topics by customizing provided templates, create new topics from scratch, or get suggestions from existing help sites.
A topic has trigger phrases—these are phrases, keywords, or questions that a user is likely to type that is related to a specific issue—and conversation nodes—these are what you use to define how a chatbot should respond and what it should do.
The AI uses natural language understanding to parse what a customer actually types and find the most appropriate trigger phrase or node.
For example, a user might type “Open hours” into your chatbot—the AI will be able to match that to the Store hours topic and begin a conversation that asks which store the customer is interested in, and then display the hours the store is open.

Entities –

A big part of chatbot conversations in Power Virtual Agents is natural language understanding, which is the ability for the AI to understand a user’s intent. For example, natural language understanding is involved when a user might say “I tried to use my gift card but it doesn’t work” and the chatbot is able to route the user to the topic related to gift cards not working—even if that exact phrase isn’t listed as a trigger phrase.
One fundamental aspect of natural language understanding is to identify entities in a user dialog. An entity can be viewed as an information unit that represents a certain type of a real-world subject, like a phone number, zip code, city, or even a person’s name.

Publishing –

With Power Virtual Agents, you can publish chatbots to engage with your customers on multiple platforms or channels. These include live websites, mobile apps, and messaging platforms like Microsoft Teams and Facebook.
After you have published at least once, you can connect your chatbot to additional channels.
Each time you want to update your chatbot, you publish it again from within the Power Virtual Agents app itself. This will update the chatbot across all the channels where you’ve inserted or connected your chatbot.
You can also configure a Power Virtual Agents chatbot to provide authentication capabilities, so users can sign in with any OAuth2 identity provider, such as Azure Active Directory (Azure AD), a Microsoft account, or Facebook.
  • Now you can create and configure the topics (Question / Answer) of your choice. In our scenario, we have created a topic to create a new “Subscriber” entity record if requested by the user. Below is the configuration of our record creation topic.
  • Within the topics, navigate to the “Authoring Canvas” to design the logic which includes the bot response, actions etc. In our case, we have designed a logic to receive the subscriber’s name from the end user and trigger a Power Automate flow to create a new “Subscriber” record according to the end user provided name.
  • Save the topic and click on the button “Topic Checker” to validate any logical errors.
  • Once the chat bot configuration is completed, navigate to the “Publish” tab and click on publish as shown below.
  • Since we have to embed the above published PVA bot in the Dynamics 365 form, we need to get the embedding URL.
  • In-order to obtain the embedding url, navigate to the “Manage” tab and click on “Channels” as shown below.
  • We can find the number of possible ways to deploy the PVA bot in the channels section. Among the given options, select “Custom Website” and copy the embed code as shown below.

Embed the Power Virtual Agent chat bot in Dynamics 365 –

We need to embed the above created chat bot in Dynamics 365 entity form. For demonstration purpose, we will embed the chat bot in the form’s panel section.

//CRM Crate - JavaScript Snippet
function CallMethod (executionContext) {
//Reading Attribute Value From The Form.

//Using loanPanel API.
//Replace The Below Given URL With Your Own Chat Bot URL.
Xrm.Panel.loadPanel("", "CRM Crate Chat Bot");

JavaScript Function Called During OnLoad Event Of Form.

Test the Power Virtual Agent chat bot in Dynamics 365 form.

Once deployed, navigate to the entity form and validate whether the chat bot is working as expected.

Thus, we learned to embed a Power Virtual Agent (Bot) into the Dynamics 365 form.

5 1 vote
Article Rating
Notify of
Newest Most Voted
Inline Feedbacks
View all comments
dynamics crm 365 trial login Customer Service Support Information, Account Bill Pay -
2 years ago

[…] Embed a Power Virtual Agent (Bot) into the Dynamics 365 … […]

1 year ago

A virtual agent also called as intelligent virtual agent (IVA), virtual rep or chatbot is a software program that uses scripted rules and, increasingly, artificial intelligence applications to provide automated service or guidance to humans. Meanwhile you can visit our website also to know more:

10 days ago

This embed chatbot on d365 CRM form after I try to moved to UAT environment as a managed component, I updated the environment id of the chat bot dynamically but it is not working. how to deploy this chat bot to another environment

Last edited 10 days ago by Venkat
error: CRM Crate Security Engine - Disabled Right Click & Selection!


Well Done,
Welcome to CRM Crate

Stay tuned with us and get all latest updates and learning in Microsoft CRM and related techonologes.