Navigate Dynamics 365 F&O using Copilot
This week, I presented about AI in Microsoft Dynamics 365 F&O together with Hylke Britstra at a Dutch Dynamics Community event. While preparing for the session, I created some demos to extend the Copilot sidecar and found some hints in the coding for using natural language to navigate the application. I will elaborate on the upcoming feature and show you how you can already enable the option to use Copilot for opening e.g. the Workflow history page.
AI in F&O session at Dutch Dynamics Community
I provided a brief history and overview of Artificial Intelligence. Also worth mentioning was Microsoft’s vision of responsible AI and the importance of good prompts.
Hylke talked about all embedded Copilot features currently provided out of the box supported with some cool demos. He talked about Copilot sidecar, Purchase orders with changes, Collections coordinator summary, and the upcoming summary features for customers, vendors, sales orders, and a few more.
At the end of the session, I showed extension options for the Copilot Sidecar in Dynamics 365 F&O using Copilot Studio. Next to adding knowledge, you can also create new topics and actions. Based on some phrases, you can add some static text to the user for additional guidance. E.g. provide a text supported with a link to internal process documentation.
I also followed a tutorial on how to translate course descriptions: Extend Copilot capabilities with low-code plugins – Finance & Operations | Dynamics 365 | Microsoft Learn
Also, you can use X++ plugins for client interactions. Inspired by changing the theme color of Dynamics 365 Finance and Operations as mentioned a TechTalk about Extending Copilot in Finance and Operations apps | TechTalk (youtube.com), I decided to use that as a demo during the presentation. During this development, I found a class in Visual Studio and a Topic in Copilot Studio for navigating the application using your natural language instead of menu navigation or using the Search for a page action in the action bar. Searching for a page is still hard using this option. Try the keyword Customer and you get 10 possible menu items, but not the All customers list page. That is showing up if you use the keyword Customers, but the results are then at the bottom.
Navigate and search using Copilot in Finance and Operations
In the Dynamics 365: 2024 release wave 1 plan, there is one feature announcement for Navigating and searching using Copilot. A preview is expected in July 2024. The announcement is about using the Copilot sidecar and your natural language to open specific pages and find specific records. The exact details are not mentioned, but I imagine a prompt like this: “Please navigate to the customer details for account Sparrow retail.“
A disclaimer must be made here. Using this type of prompts for navigation will be very welcome to add to the product but as features are not released, navigation support might be implemented in a different way. Even it can be the case that the announced feature will be postponed or removed from the current release plan.
I don’t expect that the announced feature will be removed as there is already coding for navigation implemented, but this is not working yet. Not working? Continue reading…
What is available today?
As mentioned above, while preparing for a presentation, I came across some bits of information that should give an option to open menu items using natural language in Copilot. Before going into the details, Dr. Ludwig Reinhard (aka Doctor Finance) created a post before about extending Copilot where he showed to open another page with a specific menu item. Adjust other D365 copilots in Copilot Studio | Microsoft BizApps Finance & Controlling (dynamicsax-fico.com)
In his post, he hard-coded three menu items to be used in Copilot and it opened a new browser window. Where there are now also X++ client plugins, this can be implemented differently. My preference is that it should work with The Microsoft Dynamics team is working on that.
So what components are available to make that happen? I found three objects that I will explain below.
- There is a global variable called Global.PA_Copilot_ServerForm_NavigationContext. This is a table that holds menu item labels and menu item names accessible by a user. The data is updated from the Dynamics 365 F&O application to Copilot Studio within the user context. An X++ class named SysCopilotChatApplicationNavigationContext is building the list with a limitation of 500 items. This would probably enough for business users having specific security roles assigned, but it will limit users with a lot of access permissions, such as a system administrator.
- There is a topic called AppCopilot.ServerFormAppNavigation that is having some phrases to recognize that a user would like to navigate the application which is using the global variable with the navigation context table. It also calls an action which is calling Dynamics 365 F&O logic in the client for performing the navigation.
This topic is not enabled and as it is managed, you can’t customize it. - X++ class SysCopilotChatNavigationAction. This class has a method to manage a variable (menu item name) and the execution logic to perform the navigation action to another page.
My experience
Note that below mentioned changes to get navigation via Copilot should not be implemented in a production or pre-prod environment. The suggested changes are experimental only.
I started this section with a disclaimer. As Microsoft is working on their solution, we should wait for general availability of the feature for using this in a production environment. Below experience is based on Dynamics 365 F&O application version 10.0.40 (10.0.1935.29).
As mentioned above, the topic for menu navigation is not enabled and it can’t be customized, so I created a copy into a new one as workaround. Let’s try out the feature. I opened Dynamics 365 F&O, opened the Copilot sidecar and used the prompt: “Take me to workflow“.
I got a list with menu items to choose from. When clicking on either one of them, I got a reply that the navigation was changed, but there was an error message in the Action center.
This is an unexpected bummer. The good news is that the integration is running. After a deep dive into the culprit, I found the error in the X++ class. The DataMember attribute is missing the declaration of the attribute name.
The Application foundation model is locked for customizations, so I decided to copy the class and provide another value as identifier string. Next to this change, I also corrected the DataMember decoration as you can see in the coding below.
/// <summary>
/// Provides a client side navigation action for Copilot.
/// </summary>
[DataContract]
[SysCopilotChatGlobalAction]
[SysCopilotChatActionDefinition(
identifierStr(MS.PA.Dynamicspedia.Navigation),
'Navigate',
'Navigates to a different form in the application', '', MenuItemType::Action)]
internal class DynamicspediaCopilotChatNavigationAction extends SysCopilotChatAction
{
private MenuItemName menuItemName;
[DataMember('menuItemName'),
SysCopilotChatActionInputParameter('The name of the menu for the form to launch', true)]
internal MenuItemName parmMenuItemName(MenuItemName _menuItemName = menuItemName)
{
menuItemName = _menuItemName;
return menuItemName;
}
/// <summary>
/// Navigates to the specified menu item.
/// </summary>
/// <param name="_actionDefinition">The definition of the action.</param>
/// <param name="_executionContext">The context in which the action is being performed.</param>
public void executeAction(
SysCopilotChatActionDefinitionAttribute _actionDefinition,
Object _executionContext)
{
super(_actionDefinition, _executionContext);
if (this.parmMenuItemName())
{
// Navigate
MenuFunction::runClient(this.parmMenuItemName(), MenuItemType::Display, false, new Args());
}
else
{
throw Error(Error::wrongUseOfFunction(funcName()));
}
}
}
In my topic I had to change the identifier string to call my new Copilot chat action instead if the standard. I created a small demo with the current behavior
There is more…
I copied the current available class and topic for this demo. The navigation is not always recognized for executing the action. In some cases, it will give you guidance how to open the page with information from Microsoft Learn, which is the current standard behavior of the Copilot chat feature. I tried adding some phrases, but still it comes with generic help instead of navigation.
Having a list with 500 menu items is unwieldy. In my test, it did not have the menu items I’m interested in, like All customers. There are possible some improvements to think of. In my opinion, when recognizing the keyword workflow, it should limit the list to workflow related items only. Another improvement could be prioritizing menu items that are most used by the user.
I performed a test with another user and restricting this test user to the Accounts receivable clerk role only. The list with menu items was different than the list for my administrator user. I noticed some menu items that are not visible to the user. It looks they are country related and should not be included.
Today, this feature is not ready and my attempt to make it working has still some caveats. If you are interested, you can try out the same. Note that if the navigation itself is not working, the action is not recognized on runtime. You can create a runnable class or add a button to add the Copilot chat action class with the next coding.
SysCopilotChatAction::addToCopilotRuntimeActions(
classId2Name(classNum(DynamicspediaCopilotChatNavigationAction)), false, null);
Remember that Microsoft is working on a supported solution. The final solution can be different from the demo I created here. The preview from Microsoft is expected soon.
I do hope you liked this post and will add value for you in your daily work as a professional. If you have related questions or feedback, don’t hesitate to use the Comment feature below.
That’s all for now. Till next time!
Leave a Reply
Want to join the discussion?Feel free to contribute!