Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Blogs / Learn with Subs / Calling Inventory visibilit...

Calling Inventory visibility APIs from D365F&O Copilot using topics and actions

Subhad365 Profile Picture Subhad365 7 User Group Leader
Wassup guys???
Let us talk today about a step-by-step integration strategy that can effortlessly connect Copilot’s capabilities of natural language processing to inquire from Inventory Visibility APIs. We already are aware of the immense capabilities of D365 Inventory Visibility, as is outlined in the Microsoft Learn document:
https://learn.microsoft.com/en-us/dynamics365/supply-chain/inventory/inventory-visibility
In my previous post, I have explained how can you call the Inventory Visibility APIs from Azure Functions:
https://community.dynamics.com/blogs/post/?postid=bcd2d602-3ac8-ef11-b8e8-6045bdd9204f
You can also download the source code from the following repository:
https://github.com/bholenath365/DynamicSubs/blob/main/AzureFunctionQueryIV.rar
Once you downloaded and extracted the file, make sure to
  1. Change the local.settinigs.json file contents as explained in my blog
  2. Change the name of the Azure function as needed
  3. Publish Azure function to call externally.
With that let us start the Copilot related developments, so as to make it to talk to D365F&O.

Step 1

Open Copilot studio >> select the proper environment >> Agents and ensure that you can see the Copilot for Finance and Operations and Copilot for Inventory Visibility:

Click on Copilot for Finance and operations >> Click on topics:

Click on Add a topic >> Add from Blank:

Step 2

Let us begin with triggers like:

To which the system will ask the inventory details, storing the answer in a global variable called ItemId:

To which the system will ask the legal entity details and store the same in a global variable called DataAreaId:


Next question is on the site, which it’s saving in a variable called site Id:

And finally the warehouse details:

When all these values are saved, we can now go ahead with creating actions.

Step 3

Click on the Add + Sign to select the following:


This would open a separate window to create a Flow and would wait till you have created and published the flow:

Let us create the flow now:

Step 4

The first step would be to start by adding a flow that should look like:

In the next step let us create the JSON body for the inventory visibility IP:

From here, as you have rightly guessed, let us call the Azure Function that we have already created:

URI: is the Azure function URL which you can find my going to your Azure Portal >> Function which you created >> Get Function URL:

You are passing on the JSON payload and waiting for the response from the function.

Note: why Azure function? Wasn’t using continuing with the Flow good enough?

Yes, we can also use Flow actions to continue with the rest of the steps, which Azure function is doing. In fact calling Azure function could be an additional cost, each time you are querying the inventory visibility from the Copilot. However, using Azure function parsing the JSON across calls is lot easier – especially when the responding JSON payload becomes increasingly complex.

Step 5

Give the response from Azure function back to Copilot response as follows:

Saving the Flow and publishing it, when we come back to the Copilot Studio we can now see the newly created Flow listed:

Click on it and in the input to the action, you select the variables you have created in the above step:

And then finally cast the response from this step in a message to the user:

And finally, we would conclude the topic and clear the variables:

  That’s it – we can save and publish the topic. So that when we go back D365F&O and launch Copilot side car we can see the conversation like this:

To which it responds:


With that, let me conclude this topic.
Will come back soon with more such cool hacks on Copilot and D365 soon – have a rocking new year 2025. Namaste 😊
 
 

Comments

*This post is locked for comments