Exercise - Use AI Builder actions in Power Automate

Completed

In this section, you discover and use AI Builder actions in Power Automate through the creation of a simple flow.

Prerequisites

  • Access to Power Automate.

  • A license or trial of the AI Builder.

  • An environment with a Microsoft Dataverse database. (Applicable only for work or school accounts).

  • A Microsoft Office 365 account with access to OneDrive and Excel Online (Business).

  • A basic understanding of Power Automate and experience with creating a flow is recommended.

Create a flow from a solution

To add AI Builder actions in a flow, create the flow from a Microsoft Dataverse solution.

  1. From the Power Automate home page, go to Solutions from the left navigation bar then select + New solution.

  2. Enter My AI Builder solution for Solution name, select a Publisher, and then select Create.

  3. Now select the My AI Builder solution solution to open it.

  4. Select + New > Automation > cloud flow > Instant in the action bar on the top of the screen. The flow designer screen appears and asks you to choose the trigger action.

  5. Enter My AI Builder flow for the name, select Manually trigger a flow, and then select Create.

  6. Select the trigger and then from the left hand properties panel, select Add an input.

  7. Select Text.

  8. Name your input My Text, as shown in the following figure.

    Screenshot showing the input name.

  9. Select + icon and then select Add an action. You now add an AI Builder action.

Search for and add an AI Builder action

  1. In the search field, enter "Analyze sentiment" and select the Analyze positive or negative sentiment in text action.

  2. Select Sign in if prompted.

Configure the AI Builder action

Each AI Builder action has different parameters, depending on the underlying model requirements.

For the AI Builder sentiment analysis model, Language and Text are the two mandatory fields to fill in.

  1. In the Language field, select English as the language.

  2. Select the Text field and then select the Enter the data from previous step button.

    Screenshot showing the select data from previous step button.

  3. Select My Text, which is defined in the trigger action.

    Screenshot showing the selected text input value.

    The My Text value is provided during flow testing, so you don't need to focus on it right now.

  4. Select Save. Your flow is now saved with an autogenerated name. You can change it by selecting the generated name on the upper-left corner of the flow designer screen.

Use the model's inference

For this exercise, you use a Microsoft Excel file in OneDrive to store the text sentiment that the AI model detects.

  1. Create an Excel file named AI Builder results.xlsx in your OneDrive.

  2. In this file, insert a table with two columns and then save the file (make sure that you use the Insert > Table function of Excel).

    Screenshot of Excel file showing inserted table with sortable Column1 and Column2.

  3. In My AI Builder flow, select + Insert a new step and then select Add an action.

  4. Search for add a row into table and select Add a row into a table action from Excel Online (Business).

  5. Sign in if prompted.

  6. Complete the Location, Document Library, and File fields to point to the Excel file you created.

  7. In the Table field, select the name of the table that you created in your Excel file.

  8. Select Show all.

    Screenshot showing the show all button.

  9. Select Column 1 field and then select the Enter the data from previous step button.

  10. Select My Text from the dynamic content pane.

  11. Select Column 2 field and then select the Enter the data from previous step button.

  12. Select Overall text sentiment from the dynamic content pane.

  13. The Add a row into a table action should now look like this image.

    Screenshot showing the add a row into a table flow action.

  14. Select Save.

Test the flow

Before productizing a flow, it's always a good idea to test it during design phase.

  1. Select Test on the upper-right corner of the flow designer screen.

  2. Select Manually - Perform the starting action to trigger it. and then select Test.

  3. Select Continue.

  4. Provide the value of the My Text field from the trigger action. This text is what you want to analyze the sentiment for. For this example, we enter It was the best sandcastle he had ever seen.

  5. Select Run flow.

  6. Select Done.

  7. If your flow ran successfully, you would see all steps shown with a green checkmark.

  8. You can expand the actions to view the running inputs and outputs of each action, which is a good way to debug your flow.

  9. Check that the line is correctly added in the Excel file.

    Screenshot showing records appear in the table in the Excel file.

For more information, see Use AI Builder in Power Automate.