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
- Verify the prerequisites for using prebuilt prompts.
- Make sure you have a basic understanding of low-code plug-ins.
Add a new column named 'Summary' to the Email table
Your first step is to create a new column for the summary.
Sign in to Power Apps.
If you don't already have a Power Apps account, select the Get started free link.
Select Tables from the left navigation bar.
Select the Email table, and then select Edit.
Select New column.
In the Display name field, enter Summary.
In the Description field, enter A summary of the email generated by AI.
In the Data type field, select Text and then under the Multiple lines of text section, select Plain text.
After verifying the selected options, select Save.
Add the 'Summary' column to the Email form
Your next step is to add the new column to the form.
While still in the properties of the Email table, find the Data experiences section and select Forms.
Select Email > Edit.
On the left navigation menu, select Components.
Select and drag a 2-column section onto the bottom of the form.
With the new section selected, set the Label property to AI Generated Content.
On the left navigation menu, select Table columns.
Select and drag the Summary column to add it to the new section on the form.
Select the Summary column on the form.
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.
Select the Form field height property and use the up and down arrows to change the value to 5 rows.
Select Save and publish.
Create a low-code plug-in
Now, you can create the plug-in.
On the left navigation menu, select Apps > Shared with me.
Select Dataverse Accelerator App > Play > Create automated plug-in.
In the Display name field, enter Summarize Email.
In the Table field, select Email.
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."))
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.
Open a model driven app, which includes the Account or Contact table.
In the model driven app, select Accounts.
Open an existing Account record. Create an Account record if one doesn't exist.
In the Timeline section in the center of the account form, select the plus sign (+) > Email.
In the Subject column, enter AI Summarize Demo.
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: 3I 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 CannonSelect Save.
Locate the Summary column on the form and verify it now contains a summarized version of the text.