When you get started with Power Automate, dates (type) will always trip you. But as you become more experienced… Well… It might still trip you 😅 In today’s post, we’ll see something a little more complex though: Date & Time values from a Copilot agent to an Agent Flow.

Scenario

We have date & time values in dataverse for the start and end of (fictitious) company events. Ultimately, we want our Copilot agent to create a placeholder in our calendar for this time if we decide to attend.

Dataverse

Our data will be in the Company Events table, with the following fields:

  • Name (primary – single line of text)
  • Start Date (Date and time)
  • End Date (Date and time)

Copilot Agent

For the users to be able to have a conversation with the Copilot agent, we’re going to use the Dataverse connector as a tool to retrieve information on the events.

Create an agent in Copilot Studio, and make sure Generative Orchestration is enabled. Also Use general knowledge should be turned off.

From the agent’s Overview page, navigate to the Tools tab and click on + Add a tool.

Select the Microsoft Dataverse connector and choose List rows from selected environment. Finally, click on Add and configure.

Give the connector a name and a description, then make sure to select Custom value for the inputs.

Now that we have a tool, and before we test the agent, let’s add instructions in the Overview page.

Instructions (and descriptions) are extremely important when dealing with generative orchestration or Copilot in general.

Let’s test to see if we at least, get something back 😉

Agent Flow

Let’s create our flow for the users to get their event booked!

Navigate to the Tools tab >> + Add a tool >> + New tool >> Select Agent flow.

Once in the Designer, we’ll need to add our inputs. But let’s pause for a second…

We know we’re going to receive dates, so our first thought would be to create date inputs (for StartDate and EndDate). However, we may have a few issues:

  • ❌ Date input in flow will only allow date formats (not date and time)
  • ❌ The format displayed to the user is not what we want
  • ❌ We can’t configure the Agent flow inputs (in Copilot Studio) as date & time because we’ll get a TriggerInputSchemaMistmatch error!

In order to please both (Copilot agent and the Agent flow), we’ll have everything as a string, and we’ll use the formatDateTime() in Compose actions.

Navigate to the Tools tab > Flow button > find your flow > Click Add and configure

Configure Inputs

This is an important part. We not only need to configure the inputs to pass from the Copilot agent to the Agent flow, but also spend time on the descriptions.

For the StartDate and EndDate inputs, leave it as Dynamically fill with AI, but click on Customize, and enter a description.

Also add a description for the EventName input. For example, “This is the name of the Company Event.“, and click Save.

💡 You may also experience an InvalidPropertyPath error if you changed the inputs data types. Remove the Agent flow from the Tools, refresh your browser cache, and re-add the Agent flow.

Final Copilot Agent Instructions

Finally, let’s add more instructions so the Copilot Agent knows what to do with this new tool.

And there we go! 😁

Thanks for reading! 🙂

Discover more from Veronique's Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading