FetchXML Intellisense

This is a guest writer for the site!
He is writing about the intellisense feature in the FetchXML Builder tool.
Who should write about this – other than
Mark Carrington who add the feature to the tool!


Mark Carrington:

FetchXML Builder has always supported users to build queries in a visual way – with the Query Builder pane you can add columns, relationships, sort orders and more without having to understand the FetchXML language at all. Once you’ve built your query you can run it there and then or export it in several different formats to include it in your solutions.

As you use the tool more though, you might become more familiar with the structure of the FetchXML query you see it producing. If you’re comfortable writing queries in a more code-y way you might find this quicker than using the Query Builder, and now FetchXML Builder has an improved editor to help you.

As you type your query, you’ll be shown an autocomplete menu of what can come next. This could be the name of the XML element or attribute:

or names of entities or attributes based on your current connection:

You can still type whatever you like, ignoring the suggestions, for example if you aren’t connected to the right environment and the columns you want to query don’t exist. If what you’re expecting doesn’t show up in the list though, it’s a good sign there is something wrong with your query and you’ll get an error when you try to run it.

Friendly Names

When an entity or attribute is selected in the list, its display name and description will be shown in a tooltip to the side to help describe each item.

If you have the “Friendly Names” option turned on in the Settings dialog, the display name will be shown in the dropdown list itself alongside the logical name:

Keyboard Shortcuts

You can build your query even quicker using some keyboard shortcuts along with Intellisense:

  • TAB will insert the selected item from the dropdown list. For example, from a blank query just type “<” then TAB to insert “<fetch”
  • ESC will close the dropdown list if it’s getting in the way
  • Ctrl+Space will show the dropdown list again if you need it, e.g., place the cursor inside the quotes in <entity name=””> and press Ctrl+Space to get a list of all possible entity names.

Important

At the bottom of the FetchXML editor you’ll see the following options:

For Intellisense to work you’ll need to have the “XML” or “Mini” format selected.

After you’ve entered your FetchXML query, FetchXML Builder needs to refresh the Query Builder pane with your changes for the other features of the tool to work, such as converting the query to Power Automate parameters or executing the query. I’d recommend using the “Live Update Query” option to do this – as soon as you’ve entered some valid XML the Query Builder will be updated automatically. If you prefer though you can leave this unchecked and click OK once you’ve finished entering your query.

Mark Carrington


2 thoughts on “FetchXML Intellisense

  1. Nicely done! I’m sure this will be a huge help to those of us who prefer to type XML.

    Thanks for all you (both) do for the community!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.