Power Virtual Agents empowers anybody to easily create powerful chatbots for a variety of purposes. The major attraction of Power Virtual Agent from a development perspective is its code-free graphical interface.
With Power Virtual Agents, customer support chatbots, sales chatbots, and much more can be created. Chatbots can also be created for customers and also you can use Power Virtual Agents to empower your team by creating internal chatbots, such as onboarding bots and HR bots.
Lead in CRM
As we all know a lead is a potential customer or prospect. A lead is someone who can be trailed to convert into a business opportunity in the future. Marketers generate leads on regular basis and feed them to the sales team. Creating a lead is the first sales process in CRM. Lead records are designed to store all known information on lead. The information include name, address, contact details etc…
Create lead with chatbot
By leveraging power Automate in Power virtual agent we can achieve the task of creating the lead from within the chatbot itself. The primary step to achieve this is creating a chatbot. And within the chatbot, Power Virtual Agent can be added as an action. Follow the following step to create the chatbot.
Step 1
Go to the website https://web.powerva.microsoft.com and in the right-hand side click on ‘New Chatbot’ and provide a name, select the language also select the appropriate environment in which the chatbot is to be created and click on ‘Create’ button.

Step 2: Create a new Topic
Provide the Name, Friendly name and Description. In the trigger phrase section, provide all possible trigger phrases.

Step 3: Go to authoring canvas
In the authoring canvas create a questionnaire which collects all the necessary information. In our case we are asking a question. The option selected by the user is stored in the variable named VarTopic.

Step 4: Get required information
All the personal information like name, contact details, job title etc are collected by asking appropriate question as well as by choosing the correct information to identify. For example, the ‘information to identify’ for number field is number and email for email field.
All the collected information will be stored in the corresponding variables with appropriate datatype.

Step 5: Call an action
Once all the required information is collected, call the Power Automate Flow as an action.
The detailed description of the flow will be given below step by step.

Step 6: End the conversation
End the conversation by adding the action ‘End with survey’.

Power Automate Flow
The automatic Lead creation is achieved by the chatbot with the help of power automate flow. Once all the necessary information is collected the flow can be called. The information collected by the chatbot will get stored in corresponding variables. The values stored in the chatbot variables serve as the input for the Power Automate Flow. Steps to create the flow is as follows.
Step 1: Create a flow
Add ‘Call an action’ step and click on ‘Create a flow’.

Step 2: Add input variables Create input variables to write data into the leads table. The user information collected by the chatbot is passed to the input variables of the Power Automate Flow.

Step 3: Add a new row
Add an action to create a new row in the dataverse table. Select the Leads table from the dropdown. Provide the input variables as input in the corresponding fields of the Leads table namely First name, Last name, email, phone etc.

There is no value that is to be returned to the chatbot and therefore the step ‘Return value(s) to Power Virtual Agents’ can be left blank.
Once the Automate flow is done, save and test the flow. Now in the Power Virtual Agent it asks for the values that has to be passed to the power automate so that those values can be written to the Leads table as a record which eventually reflect as a lead.
Now test the chatbot by giving the trigger phrase as input.

Form the Fig. 10 we can see that all the necessary information is collected by the chatbot which is then passed to the Power Automate in the backend. The Power Automate flow creates a Lead record in the Leads table with the information collected through the chatbot.

In the above figure we can see that a lead is created with the details collected by the chatbot.