If you navigate to the classic workflow designer you’ve probably seen the recommendation to use Microsoft Flow for background workflows. Although we’re not completely there yet with parity between the two – Power Automate is the way forward.
Without mentioning all the differences between Flows and Classic Workflows, Power Automate has one HUGE advantage: List Records. Something that workflow builders like myself dreamt of for years and had to turn to code and CWAs so solve. The ability to list and add actions to several associated records.
In a former blog post I wrote about how to use the Fetch XML Query which is a great choice (read more about that here: Retrieve Records in N:N relationships with FetchXML and the New CDS Connector in Microsoft Flow). But sometimes you just want a simple filter and use the ODATA Filter query option of the action. I do not really feel that writing ODATA queries is my thing, nor something I’m eager to learn, so I was happy when there was a shortcut introduced!
If you haven’t downloaded and used XrmToolBox yet you’ve probably spent a huge amount of hours on tasks that you didn’t have to. It’s filled with tons of tools that enables you to perform tasks quicker and more efficient than using admin interface.
FetchXML Builder is one of those tools, built by my very lovely friend and colleague Jonas Rapp. So what does it do? Well besides the obvious that it helps you build FetchXMLs, it can help you with writing that complex ODATA query!
Well let’s say our scenario is to filter a list all Accounts that are Preferred Customers. Start by doing an Advanced find with that filter if you don’t already have a saved view with that exact filter, then download the Fetch XML and save it to your desktop.
Either choose Open View from your CDS organization or use Open File for the FetchXML you just downloaded.
You can already get an idea what your filter query will look like by looking at the FetchXML Builder to the left, but go to the Menu and pick View and then Flow List Parameters.
Flow List Parameters pops open and you can just easy peasy click on the filter query to copy it and use it in your Flow!
Big thank you to Mark Carrington and Jonas Rapp for contributing to this feature that allows me to continue to be lazy and taking the easy way out. Kudos!
Original Post https://saralagerquist.com/2019/11/13/be-lazy-filter-list-records-in-power-automate-with-fetchxml-builder/