Use a prebuilt prompt in a Dataverse low-code plug-in in Power Apps (preview)

[This topic is prerelease documentation and is subject to change.]

A low-code plug-in can enable advanced business logic without the need to write code. Instead you can use PowerFx, which is an expression language similar to Excel. In the following example, you add a column named Summary to the Email table. Then, you create a low-code plug-in that uses the AISummarize prebuilt prompt to summarize the email and save the summary into the new Summary column.

Important

  • This is a preview feature.
  • Preview features aren’t meant for production use and may have restricted functionality. These features are available before an official release so that customers can get early access and provide feedback.

Prerequisites

Add a new column named 'Summary' to the Email table

Your first step is to create a new column for the summary.

  1. Sign in to Power Apps.

    If you don't already have a Power Apps account, select the Get started free link.

  2. Select Tables from the left navigation bar.

  3. Select the Email table, and then select Edit.

  4. Select New column.

  5. In the Display name field, enter Summary.

  6. In the Description field, enter A summary of the email generated by AI.

  7. In the Data type field, select Text and then under the Multiple lines of text section, select Plain text.

  8. After verifying the selected options, select Save.

    Screenshot of the completed 'New column' dialog.

Add the 'Summary' column to the Email form

Your next step is to add the new column to the form.

  1. While still in the properties of the Email table, find the Data experiences section and select Forms.

  2. Select Email > Edit.

  3. On the left navigation menu, select Components.

    Screenshot of the 'Components' option that you use to add the new column to the email table.

  4. Select and drag a 2-column section onto the bottom of the form.

  5. With the new section selected, set the Label property to AI Generated Content.

  6. On the left navigation menu, select Table columns.

  7. Select and drag the Summary column to add it to the new section on the form.

  8. Select the Summary column on the form.

  9. In the properties section on the right side of the page, select the Form field width property and use the dropdown menu to change the value to 2 columns.

  10. Select the Form field height property and use the up and down arrows to change the value to 5 rows.

    Screenshot of the 'Formatting' dialog with the new field width and height selections.

  11. Select Save and publish.

Create a low-code plug-in

Now, you can create the plug-in.

  1. On the left navigation menu, select Apps > Shared with me.

  2. Select Dataverse Accelerator App > Play > Create automated plug-in.

  3. In the Display name field, enter Summarize Email.

  4. In the Table field, select Email.

  5. In the Expression field, enter the following value:

    Set(Summary, AISummarize(Description))

    Note

    The formula previously shown uses AI to summarize the email regardless of the length. Alternatively, you can use a condition in the formula to summarize only if the length of the text is more than a specified size. In the following example, the text is summarized only if the length of the Description field is more than 1,000 characters. If it's less than 1,000 characters, the Summary is updated with the text, Emails shorter than 1,000 characters are not summarized.

    If (Len(Description) > 1000, Set(Summary, AISummarize(Description)), Set(Summary, "Emails shorter than 1,000 characters are not summarized."))

    Screenshot of creating a new plug-in in the Dataverse Accelerator App.

  6. Select Save.

Test the low-code plug-in

In the following example, the Sales Hub app is used. Any app where you have access to a table such as Account or Contact, which can have activities associated with it, works.

  1. Open a model driven app, which includes the Account or Contact table.

  2. In the model driven app, select Accounts.

  3. Open an existing Account record. Create an Account record if one doesn't exist.

  4. In the Timeline section in the center of the account form, select the plus sign (+) > Email.

  5. In the Subject column, enter AI Summarize Demo.

  6. In the email body section, enter the following text. It's intentionally lengthy so that you can easily notice the difference once your plug-in summarizes it. A screenshot of the summary is in step 8.

    Dear Customer Support Team,

    I hope this email finds you well. My name is Paul Cannon, and I am writing to you regarding my recent order (#123456) placed on your website. I have been a loyal customer for several years, and this is the first time I have encountered such a significant issue.

    Upon receiving my order yesterday, I was dismayed to find that several items were missing from the shipment. I carefully checked the packing slip against the items in the box, and it appears that the following items are missing:

    Product A - Quantity: 2
    Product B - Quantity: 1
    Product C - Quantity: 3

    I have attached a photo of the packing slip and the contents of the package for your reference. As you can imagine, I am quite disappointed as these items were intended for a special event happening this weekend, and now I am left without crucial components.

    To complicate matters, I also noticed that one of the items I did receive, Product D, arrived damaged. The packaging was torn, and upon inspection, the product itself has visible scratches and dents. I have attached images of the damaged item for your review.

    I understand that errors can occur in the fulfillment process, but I am hopeful that your team can rectify this situation promptly. As the event is fast approaching, time is of the essence. I kindly request that you:

    Ship the missing items (Product A, B, and C) via expedited shipping to ensure they arrive before the weekend. Provide instructions for the return of the damaged item (Product D) and arrange for a replacement to be sent out at your earliest convenience. I appreciate your immediate attention to this matter and trust that your team will handle it with the efficiency and professionalism I have come to expect from your company. Please confirm receipt of this email and update me on the status of the resolution process.

    Thank you for your understanding and assistance.
    Best regards,
    Paul Cannon

  7. Select Save.

  8. Locate the Summary column on the form and verify it now contains a summarized version of the text.

    Screenshot of a summary of the text in the email body.

Use Dataverse low-code plug-ins (preview)