How to use Autocomplete of Dataverse Search in Canvas App?

By | March 7, 2023

Recently, I was working on a requirement in the Canvas app regarding autocomplete. We wanted to display the auto-complete suggestion based on the account names as they were typed in. After fiddling around with the requirement, I stumbled upon the Dataverse Search. Microsoft recently came out with Dataverse Search API, which consists of various search features, and autocomplete is a part of it. Let’s dive in and see how to use that in a Canvas app.

So, for a basic setup, I’ve taken one text input and one label control. On change of the text input, I will call a Power Automate Flow, which will return the autocomplete response.

Power Automate Flow –

In the power automate flow, I’m calling the autocomplete API shown below –

Canvas App

The API of autocomplete goes like {crmURL}/api/search/v1.0/autocomplete and in the body of the request, we need to pass the search term, which I’m passing from the Canvas app and restrict the autocomplete to only account entity. After getting the response from the API, we need to parse the response, which is in JSON form, as shown below –

Canvas App

After parsing the response, I’m storing the value after removing the {crmhit} & {/crmhit} that is returned in the response. So, for that, we will use replace function provided in Power Automate Flow as shown below –

Canvas App

After storing the autocomplete response in a variable, I’m simply returning it to the Canvas app like below –

Canvas App

This is it for the Power Automate Flow; now we will see the Canvas app.

In the Canvas app, I’ve added a text input control. On change of the same, I’m calling the Power Automate Flow that we created before and storing the response passed from flow in a variable like below –

Canvas App

And in the Text property of label control, I’m showing the variable that we’ve stored.

Canvas App

So, after everything is set up, let’s see the autocomplete in action.

Conclusion

This is how we can use autocomplete feature in the Canvas app.

Want to visualize, design, and build a business app from a canvas in Microsoft Power Apps?

Wish to do it without writing code in a traditional programming language?
Contact us at crm@inogic.com and our Microsoft Dynamics 365 and Power Platform Inogic- Professional Services Division will help you achieve it effortlessly!”