cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Microsoft
Microsoft

Beginner Help - PVA to Create new record in Custom Entity from PVA Variables

I am trying to understand how to set up an Action from PVA to create a new record in a custom entity but I am having issues understanding how to set the Input section, and Return values. I also am not sure where to add the "Create a New Record" and where it should be placed on the page and how to use the variables in the "Create a new Record" action.  I have about 7 variables that need to be placed in the custom entity. This is really my first flow so I appreciate any help!

 

bradlaw_0-1601934083908.png

 

7 REPLIES 7
Highlighted
Super User
Super User

Hi @bradlaw ,

 

No worries, I'll send an example below and I hope that can help you:

 

Common Data Service (entities)

I created an entity called "Expenses" with fields: Date, Title, and Type.

 

Power Virtual Agents (chatbot)

I created a chatbot that has a topic called "Register an expense" with trigger phrases: I want to register an expense, ...

Inside this topic, I created 3 questions:

1- When do you want to register this expense? (identity: User's response | output variable: Date)

2- What's the name of your expense? (identity: User's response | output variable: Title)

3- What's the type of expense? (identity: User's response | output variable: Type)

4- Create an action calling the Power Automate

 

Power Automate (workflow)

I created a workflow that the trigger is the Power Virtual Agents (similar that you posted) and the inputs is:

Date - string

Title - string

Type - string

 

I created an action called "Create a new record" using the Common Data Service (similar that you posted) and connect the entity with my Expenses entity.

Now, I can see some inputs that need that I selected, like Date, Title and Type, and I can see on the Dynamic content all values come from Power Virtual Agents trigger.

I select one by one.

 

I created an action called "return value(s) to Power Virtual Agents" (similar that you posted) and I can create output variable or no, I decide if I want or no. 

If I want to return to Power Virtual Agents the Title of my Expense, I need to create an output called "TitleResult" and select the value on the Dynamic content.

 

Power Virtual Agents (chatbot)

Now, you can create an action calling from Power Automate and select your workflow, select all inputs with the topic variables.

And after the workflow action inside the topic, you can create a message to the user like:

 

Thanks, you create an expense called: {and here, you can see the {x} icon on the message, and use the TitleResult here}


Did I answer your question? Mark my post as a solution!
Thanks!

Renato Romão,

Connect with me here 😉

Power Virtual Agents course (+1.000 students | 25% OFF) : https://www.udemy.com/pva-beginners
Highlighted

Ok this helps me formula  my questions and clarify a few things. 

 

  1. In my use case a user is selecting from a few options I give them that I want to use to create a new record with. I am not using "User input fields," open text fields from PVA. I am using the results of items the user selects that I defined as "Entity" options in PVA. they are pre set Topics, Sub-Topics and Inquiry Types all set up as Entities in PVA. 
  2. When I create Topics, Sub-Topics and Inquiry Types in Power Automate (Power Virtual Agent section where you create the variables) I can only see them in Power Automate Dynamics Content if I am selecting a fields that isn't an Option Set in CDS. These are Option Sets in CDS, not text fields. 😞
  3. When you use the following variables, are these the same name as the variables in PVA? I am not seeing the relationship between the variables defined in Power Automate (Power Virtual Agent section where you create the variables) and the Dynamics Content? I guess I expected the Dynamics Content to be populated with the variables defined from PVA?

Date - string

Title - string

Type - string

Highlighted

Hi @bradlaw ,

 

Follow below my comments:

 

  1. In my use case a user is selecting from a few options I give them that I want to use to create a new record with. I am not using "User input fields," open text fields from PVA. I am using the results of items the user selects that I defined as "Entity" options in PVA. they are pre set Topics, Sub-Topics and Inquiry Types all set up as Entities in PVA. 
    No worries, you can use the values selected by the user inside the question with identity connected to the Entities (PVA).

  2. When I create Topics, Sub-Topics and Inquiry Types in Power Automate (Power Virtual Agent section where you create the variables) I can only see them in Power Automate Dynamics Content if I am selecting a fields that isn't an Option Set in CDS. These are Option Sets in CDS, not text fields. 
    If you are using the Option Sets, you will need a more complex scenario to do it because of which option is a code inside the CDS database. I recommend you to change the type of field inside your CDS entity.
  3. When you use the following variables, are these the same name as the variables in PVA? I am not seeing the relationship between the variables defined in Power Automate (Power Virtual Agent section where you create the variables) and the Dynamics Content? I guess I expected the Dynamics Content to be populated with the variables defined from PVA?
    I create the same name to help you, but you can create inside your workflow (Power Automate) three inputs called "NumberOne, NumberTwo, NumberThree". Inside your PVA topic, you will see the three inputs that you will relate with your question that you send to the user. And inside your workflow (Power Automate), you will see the three inputs inside the Dynamic content.
    You can see my video here: https://www.youtube.com/watch?v=aJN-2QkT3Uc&list=PLWGKTxKF5vWc9YwqLkZB34oqJ1FGxrlSk&index=9

 


Did I answer your question? Mark my post as a solution!
Thanks!

Renato Romão,

Connect with me here 😉

Power Virtual Agents course (+1.000 students | 25% OFF) : https://www.udemy.com/pva-beginners
Highlighted

Awwwww. I think I got it, I simply wasn't returning back to PVA to match the variables. lol

 

Now I shouldn't expect to be able to test this out from either PVA or PA?

Highlighted

Yes @bradlaw , you can test your chatbot or publish and test inside the Demo website channel.


Did I answer your question? Mark my post as a solution!
Thanks!

Renato Romão,

Connect with me here 😉

Power Virtual Agents course (+1.000 students | 25% OFF) : https://www.udemy.com/pva-beginners
Highlighted

Thanks, and I see it will actually create a record. thanks again and I subscribed to your channel!

Highlighted

Hello @bradlaw 

 

What is the status on your question. If your problem was solved, could you accept a solution, this will help others find answers more quickly.

 

Thanks





Did I answer your question? Mark my post as a solution!

If you like my post please hit the Thumbs Up


Proud to be a Flownaut!


Check out my blog for Power Automate tips, tricks, and guides
FlowAltDelete




Helpful resources

Announcements
PVA Commnity Blog

NEW Power Virtual Agents Community Blog

View articles posted by fellow community members on the Power Virtual Agents Community Blog!

Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Top Solution Authors
Top Kudoed Authors
Users online (13,911)