Dynamics 365 Business Central: PromptDialog page type (Integrate copilot capabilities)

Dynamics 365 Business Central

Hi, Readers.
Minor update 23.1 for Business Central 2023 release wave 2 has been released. More details: Cumulative Update Summary for Microsoft Dynamics 365 Business Central(November, 2023) and What’s new and planned for update 23.1 for Microsoft Dynamics 365 Business Central 2023 release wave 2: Link.

With this minor update, Microsoft brings a new Copilot & AI management page, Copilot AI Capabilities (7775, Document). In Business Central, search for and open the Copilot & AI Capabilities page. More details: Configure Copilot and AI capabilities (New Copilot & AI capabilities page)

And in this version, Microsoft also released a new page type, PromptDialog page type. In AL Language extension changelog Version 12.2, Microsoft mentioned the following new updates:

PromptDialog page:
Introducing the new page type PromptDialog, which allows developers to seamlessly integrate Copilot capabilities into their custom scenarios. Use this page to create generative AI experiences that look and feel unmistakably Copilot, including signature visuals, and built-in safety controls for customers. You can build these pages directly in AL using a special page syntax, which includes new area and action controls, as described in the code sample below. To get started, simply type tpage and pick the Page of type Prompt Dialog snippet.

For example,

Sparkle Image
Added a new option to the Image property, Sparkle, which you can use to highlight the presence of your AI-powered features. For example, place it on actions that open a prompt dialog page.

For example,

The following standard documents have been updated:

Page types and layouts:

Page typeExamples of useMain data displayCharacteristics
PromptDialogA page that enables creating generative AI experiences with the copilot look and feelSingle or collection

PageType Property:

ValueAvailable or changed withDescription
PromptDialogruntime version 12.1Dialog that prompts the user for input and shows the output of a copilot interaction.

The PromptDialog object: With Business Central runtime 12.1, you can add a new page type PromptDialog, which allows you to integrate copilot capabilities into your custom scenarios.

If you want to see standard examples, you can find them in Marketing text suggestions (feature is generally available with Update 23.1) feature.

page 5836 “Copilot Marketing Text”:

And Bank Account Reconciliation With AI extension:

page 7250 “Bank Acc. Rec. AI Proposal”:

Okay, let’s see more details.

First, for the action of opening PromptDialog page, it is recommended to set Sparkle Image.

Then we can create a page and set the PageType Property to PromptDialog

PS: The PromptDialog page type has many specific properties that characterize the dialog.
1. ‘PromptDialog’ is not available in runtime version ‘12.0’. The supported runtime versions are: ‘12.1’ or greater. AL AL0666

2. The property ‘PromptDialog’ can only be used if the property ‘Extensible’ is set to ‘False’ AL AL0223

3. IsPreview property: Specifies if the page is available as part of a preview release.
The IsPreview property displays a note in the UI that the page is available as part of a preview release. The default value is false. This property is used when the PageType property is set to PromptDialog.

4. The Caption set on the page will be displayed in the upper left corner of the PromptDialog page.

5. The PromptMode property value is by default Prompt, which is the starting prompt mode.

The PromptMode property can be changed at runtime. The other options are Generate, which triggers generating the output of the copilot interaction, and Content, which shows the output of the copilot interaction.

ValueAvailable or changed withDescription
Contentruntime version 1.0Prompting the user for input for the copilot interaction.
Generateruntime version 1.0Generating the output of the copilot interaction.
Promptruntime version 1.0Showing the output of the copilot interaction.

You can programmatically set this property by setting the variable CurrPage.PromptMode before the page is opened.

6. DataCaptionExpression Property: Sets an AL expression that is evaluated and displayed to the left of the page caption.

7. You can have a source table for a PromptDialog page, as long as the source table is temporary. This is optional, though. The meaning of this source table is slightly different than for the other page types. In a PromptDialog page, the source table should represent an instance of a copilot suggestion, that can include both the user inputs and the Copilot results. You should insert a new record each time the user tries to regenerate a suggestion (before the page is closed and the suggestion saved). This way, the Business Central web client will show a new history control, that allows the user to go back and forth between the different suggestions that Copilot provided, and choose the best one to save.

History Control:

8. This page can also be opened via Tell Me. ApplicationArea Property and UsageCategory Property

The PromptDialog page type has three areas, which are PromptContent, and PromptOptions.

The Prompt area is the input to copilot, and accepts any control, except repeater controls.

The Content area is the output of copilot, and accepts any control, except repeater controls.

We can also add multiple fields, or Part in the Content area.

On this page, you can review the generated results.
Like:

Dislike:

The PromptOptions area is the input options, and only accepts option fields. Here you can add different settings to tweak the output that Copilot will generate. These settings must be defined as page fields, and must be of type Option or Enum. You cannot define groups in this area.

Next is let’s move on to the actions on the PromptDialog page. On this page, we can only use Pre-defined system actions (Generate, Regenerate, Attach, Ok, or Cancel). So you can have custom behavior for the main system actions in a PromptDialog page, such as generating a suggestion with copilot, regenerate, or discard the suggestion.

Generate: The action used to start copilot processing when the dialog is in prompt mode.

Regenerate: The action used to start copilot processing when the dialog is in content mode.

Attach: The action used to include attachments to the prompt’s input area.

Ok: The action used to accept the content and dismiss the dialog.

The trigger ‘OnAction’ cannot be defined on the system action named ‘Ok’ in a page of type ‘PromptDialog’. AL AL0811

The behavior of this action is written in the OnQueryClosePage trigger.

Cancel: The action used to discard the content and dismiss the dialog.

The trigger ‘OnAction’ cannot be defined on the system action named ‘Cancel’ in a page of type ‘PromptDialog’. AL AL0811

The behavior of this action is written in the OnQueryClosePage trigger.

When you develop a Copilot feature, remember: the user should always be in control (the user must confirm anything Copilot suggests before any change is saved). This is also the reason why you cannot have a physical SourceTable in a PromptDialog page (you either use a temporary table, or no table).

PS: If no caption is set for these actions, the default caption will be displayed, and you can change them according to your needs.

Okay, that’s all for this page. But I’m sure you’re wondering, there’s no AI-related code in the current presentation. Yes, to integrate AI, three prerequisites are currently required.

  • Azure OpenAI Resource URL
  • Deployment Name (MyGPT3.5)
  • Azure OpenAI API key

This requires requesting the Azure AI service in the Azure Portal.

You will then need to register your AI features into Copilot & AI capabilities, currently this can only be done via code, you can also set up authentication information at this point.

More details: Configure Copilot and AI capabilities (New Copilot & AI capabilities page)

Here are two standard examples provided by Microsoft that you can refer to.

Please note that it is not yet available in the current latest SaaS version, Version: W1 23.1 (Platform 23.0.13763.0 + Application 23.1.13431.13546):

Available now to Insider Builds. Partners will be able to deploy and run to Business Central Online once we light this up in a minor update.

And as of now, this page does not support mobile devices.

The page type PromptDialog is not supported.

Phone:

Tablet:

If requesting support, please provide the following details to help troubleshooting:
The page type PromptDialog is not supported.

Internal session ID:
e27b5801-e66f-46fc-8314-b817c1a7792d
Application Insights session ID:
b1060893-623a-4db1-8fee-33bd28ea4367
Client activity id:
f8791a12-04ac-4e07-bbf7-934b4199e8ac
Time stamp on error:
2023-11-16T06:47:21.4163882Z
User telemetry id:
ee11aaa2-6a5a-42f0-bf88-817743bdcdb9

Great. Give it a try!!!😁 I will continue to discuss this topic in depth sometime in the future.

PS: The following is some information from Microsoft, hopefully it will give you some help as well.

1. Get started with developing generative AI features for Dynamics 365 Business Central 

2. Easily integrate generative AI with your AL solutions:

Business value:
Azure OpenAI Service offers powerful, generative AI models that our partners can now leverage to deliver a rich ecosystem of AI-powered extensions for Business Central. With only a few lines of AL code, developers can enhance their solutions with generative AI that feels seamlessly integrated into the Business Central user experience and can be delivered as a natural part of their add-ons or customizations.

https://learn.microsoft.com/en-us/dynamics365/release-plan/2023wave2/smb/dynamics365-business-central/easily-integrate-generative-ai-al-solutions

3. 2023-11-16 Are you looking into creating generative AI solutions for Business Central?

Then read on here. As you move forward with exploring generative AI, we’ve published a couple of articles to get you started. There’s a new article for the PromptDialog page type and we’ve also updated the reference documentation for the following properties: PromptMode  IsPreview PageType

This serves as a starting point for other documentation that we’ll be shipping on how to get started developing a generative AI solution with Business Central.

Remember that you can go to the aka.ms/BCTech repo to discover more and maybe get inspired.

At Directions EMEA 2023, the keynote presentations demonstrated how Business Central has integrated AI to enhance productivity. Check these recordings out here.

Stay tuned!

Update: Build copilot user experience with the prompt dialog page type

END

Hope this will help.

Thanks for reading.

ZHU

コメント

Copied title and URL